PDA

View Full Version : What's the most elegant way to code this?


pixielex
02-08-2008, 06:30 PM
OK, I'm hoping someone here can help me wrap my head around how to code this. I have a slide show, where the images animate in from the side. I'm doing this by having two different Loader objects that I alternate between.

What I want to do is have caption text for the images animate in along with the image, with a semi-transparent background box behind the text. I'm assuming I will have to do the same alternating-between-two-objects trick, and I know how to set up the text field, but how do I do the transparent background, and then get it to animate together with the text field as a single object?

Thanks!

stompwampa
02-08-2008, 06:34 PM
Why do you need two loaders? Is each image going to push the next one off the other side of the page when it comes in? If not, you could probably to it with one loader.
Put your loader and the text field inside of a movie clip.
Then use ActionScript tweens to move the movieclip into position, and then move it out of position when the new one arrives.

pixielex
02-08-2008, 06:40 PM
yes, I am having each image push the previous one off the side of the stage, that's why I'm using two.

I had thought of putting this all inside one movie clip, but I was having trouble getting that to work just with the text field and the text background. The text and the image stuff are being handled in two separate classes, and I really don't know how to combine objects from two separate classes into a single movie clip.

stompwampa
02-08-2008, 06:41 PM
well, you can just use two movie clips....put everything for one loader into movieClipA and everything for the other loader in movieClipB

Also, to get the dynamic text to animate, you need to embed the fonts.

pixielex
02-08-2008, 06:48 PM
OK, I understand that, but my question is not about how or whether to use two movie clips. My question is how to put objects (in this case, the text field, the text background, and the image loader) into another object (the movie clip), especially when the text stuff and the image stuff is in two different classes. Do I just addChild to the movie clip? And where do I control it from (which class) and how do I get all of the variables to pass back and forth between classes? It just all seems really complicated...

stompwampa
02-08-2008, 07:12 PM
Well....I don't use classes for much of anything....I do all my coding on the main timeline....so I can't really help you there. But it just seems easier to do something this simple on the timeline as opposed to creating classes for everything....

jaga
02-08-2008, 08:26 PM
pixielex, you probably want to make a class that extends sprite, and inside have instances of your text and your image/loader inside of that class..

then have a class with multiple instances of that, that animates the way you want it to.

Coding on the main timeline is fine for static animation, but it sounds like you want something a bit more dynamic