This content has been marked as final. Show 7 replies
"M*A*S*H 4077" <email@example.com> wrote in message
> I create some images dynamically by running a for from 1 to a variable
> The pictures have the IDs image1, image2 ... ("image"+i). I then add other
> Problem is for each I need an onMouseOverHandler thant will swap the image
> with another.
> I can get the target image with event.currentTarget.id. But I cannot set
> properties with this["image"+i].source (I need to change the ones up to
> that as
> well) and I cannot access it with this.getChildByName("image"+i).source
> What am I doing wrong please?
ID is about as useful as your appendix when you create objects dynamically.
The event.target property will contain a reference to your image.
Haha! But I sometimes type with my appendix! :D
However, there is a problem here as I need to change all pictures up to the one the mouse is over.
Meaning if mouse is over image4, I need to change images 1 to 4.
I couldn't get this code to work as I wanted it to (when image source is changed, mouseOut immediately fires), but it may be of some use:
Hmm, your post gives me an idea, Greg! :)
I can have an ArrayCollection in which I can add the objects created and so call their properties... should work, shouldn't it?
That might work.
Woo Hoo! It works!
So: create objects dinamically, save them into an ArrayCollection variable which was declared, then you can call properties/methods for those objects by myAC['something'].property etc
Thanks ever so much, Greg! Your code did it.
Very kool. Glad to help...