New to flash. When playing with a dummy ‘tutorial’ app, we saw that when we added a text box to a layer, Flash allowed us to give it an instance name, which was then available to us in ActionScript for things like setting its text, size or visibility.
However, when we added a png file, there was no place to type an instance name, so I’m not sure how we access that object from ActionScript.
Now I know I can simply assign the image to its own layer, than manipulate the layer, but in our case, we have a 6 x 6 matrix of images that we just need to show or hide individually, and creating 36 layers (as opposed to a single layer with 36 images on it) just seems crazy to me!
So how can you target specific images on a layer from ActionScript?
If you’re planning on keeping things laid out on the stage/timeline, then:
Select the image, click Modify > Convert to Symbol. From there you’ll be able to turn it into a MovieClip, and you can assign MovieClips instance names.
UPDATE:
If what you’d like to do is have 36 copies of the same bitmap that you can interact with via ActionScript, you’ll be better off instantiating all of those instances programmatically:
Convert the bitmap into a MovieClip as above. That Symbol is now in your library – right click on it and click “Properties”. In the “ActionScript Linkage” section, click to enable “Export for ActionScript”. In the “Class” dialogue, give it a class name, like
MyBitmapClass. You’ve now made that MovieClip available as a class.To create 36 copies of it on the stage programmatically:
Of course, all you’ll see if you run this is “one” bitmap, because all 36 are laying on top of each other. To move an individual bitmap, you can access its instance through the array we made:
(Keep in mind that the array positions start at 0, so that’s why bitmap #5 is actually at index 4 – 0, 1, 2, 3, 4)