|
-
Senior Member
[AS3] slideshow problem
I am coding a simple slideshow, where I load images with XML, and then tween through them.
The tween/transition is basically a function I wrote to cut the image in small pieces and have each individual piece tween in. This works well enough for jpg/png, but as soon as I try doing this with a swf instead of a image, strange lines appear, as if it didn't load the entire swf, or couldn't extract the bitmapdata.
Code:
private function chopImage(cimg:Loader,holder:Sprite):void
{
var mainPic:BitmapData = new BitmapData(cimg.width, cimg.height, false);
mainPic.draw(cimg,null,null,null,new Rectangle(0, 0, cimg.width, cimg.height));
for (var i:int = 0; i < splitv; i++)
{
for (var j:int = 0; j < splith; j++)
{
var bmd:BitmapData = new BitmapData(cimg.width / splith, cimg.height / splitv);
bmd.copyPixels(mainPic,new Rectangle(j * (cimg.width / splith),i * (cimg.height / splitv),cimg.width / splith, cimg.height / splitv),new Point(0,0));
var bm:Bitmap = new Bitmap(bmd);
var temp:Sprite = new Sprite();
temp.addChild(bm);
slide.addChild(temp);
temp.x = j * (cimg.width / splith);
temp.y = i * (cimg.height / splitv);
);
}
}
slide.x = (stage.stageWidth - slide.width) / 2;
slide.y = (stage.stageHeight - slide.height) / 2;
Any suggestions?
If you like me, add me to your friends list  .
PS: looking for spriters and graphics artists for a RPG and an Arcade fighting project. If you can help out, please pm me!
My Arcade My Blog
Add me on twitter: 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|