Images in Grid in Actionscript?
- Started
- Last post
- 9 Responses
- boobs
I'm having trouble getting my mind around this. I need to take images randomly from a folder, and add them to the stage arranged in a grid. I know how to get the images from the folder onto the stage, but how would I write the code so the images are arranged into a grid?
- acrossthesea0
I'd put all your image paths in an array and handle all this in a loop while managing a counter for your rows and columns
Something like this should do the trick...
http://pastebin.com/m44f1dc9a- Hey, your email doesn't seem to work, and I had another question!boobs
- boobs0
That is very helpful! Take a wee squeeze!
- boobs0
Now how do I add all those loaders to MovieClips so I can move them around and re-size them? Anything that has an
addChild()
in it gets me totally fucked.
- Pupsipu0
there should be examples in the help for this stuff. You make a bunch of loaders, add onComplete event listeners to them, and inside onComplete function you addChild( event.target.content ) to a movieClip.
- acescence0
http://pastebin.com/m48c05f06
something like that
then you reference your images via the myimages array
- boobs0
OK. So I get that working, and it looks like ass, because the scaled MovieClips of the images look all jaggy to hell. So I hit it with this:
mov.cacheAsBitmap = true;
And they still look like ass. What's the code to apply smoothing to that? I honestly can't find this in the help...
- Pupsipu0
from here http://www.kirupa.com/forum/show…
you'd say inside the onComplete function
var bm:Bitmap = event.target.content as Bitmap
bm.smoothing = true
var mc:MovieClip = new MovieClip()
mc.addChild(bm)
addChild(mc)
- boobs0
Thanks! Have a wee squeeze!
- acrossthesea0
boobs is love