Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flash 5 is ticking me off with Targets

Status
Not open for further replies.

soulknite

Technical User
Jan 11, 2002
11
US
You know, someone at Macromedia just has to mess up a good thing just so he could get a promotion. This Flash 5 actionscripting is making me angry. They expect everyone now a days to be programmers overnight. Tell Target is depreciated and WON'T WORK right if you publish to 5, I tried using the "with" string and that in itself isn't working.

All I'm trying to do is go to different scenes with buttons THAT ARE CONTAINED in a movie clip. I have:

Preload
Scene 1
Scene 2
Exit

I use the "with" command to go to the root and go to scene 2 and play frame 1, but nothing happens or if it does, it goes way to preload, frame 1. Then I put a lable on the frame (which is stupid cuz the first technique should work or macromedia shouldn't put it in there in the first place), and told the "with" command to go to that scene and nothing happens. The only way I can get this to remotely work is to change my publish settings to version 4 and use the tell target, but this is very bad because all my movies clips MUST be change to 'slashes' instead of 'dots' and that will take forever.

Does someone have a solution to the "with" command that I can use to go to a measly scene? Or must I go and redo my paths to work with Flash 4? And what's this I hear about Flash 5 forcing people to download plugin5 when you are publishing for 4? One of the best media programs is shafting the very community it relies on.
 
hi soul

Yup, it's all a pain the the grass. But leave your frame labels in there and use:
Code:
_root.gotoAndPlay("yourframelabel");

.....or gotoAndStop, whichever it is your trying to do. Always best to use labels when targetting a particular frame if possible. Just one of those things.

dave
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
Took me some time too to get at ease with dot syntax vs tellTarget, I had just started to understand when I switched to Flash 5.
But once you get the hang of it, it avoids a lot of extra typing.
The WITH action is another story, and I just forgot about it.

The reason goto(s) to control the main timeline won't work within movie clips (or for that matter from external .swfs loaded on other levels), is really simple:
Once compiled into one .swf, scene name's references simply don't exist anymore, and movie clips or loaded movies see the main timeline as one big scene, even if it held several, when designing it.
So the only way to target a particular frame is to use a cumulative frame number or, as Dave has suggested, target a labeled frame.

So to target frame 1 of Scene 3, and supposing the Preload scene held 10 frames, Scene 1 held 100 frames and Scene 2 held 50 frames, you would have to target frame(10+100+50+1=161) as:

_root.gotoAndPlay(161);

In the above _root is the equivalent of Flash 4's "/", and is absolutely necessary when targeting the main movie from a movie clip. Otherwise if you only used gotoAndPlay(161); alone, it would be looking for frame 161 within that movie clip. The problem with this method is that if you edit(shorten previous scenes to your targeted frame...), you'll have to constantly re-calculate the cumulative frame number of your targeted frame and change it accordingly in all your goto(s).

A better method, as Dave suggested, is to target a labeled frame. Unless you delete a label, once named, it will allways be attached to that particular frame, no matter what editing you do in previous scenes, thus rendering this whole targeting business much easier!

In the above example, if you had labeled frame 1 of Scene 3 with my_start3, for example, you would simply use:

_root.gotoAndPlay("my_start3");

Now if your were targeting another labeled frame my_label within another movie clip also on the main timeline, you would simply add that movie clip's instance name in the path as:

_root.othermc_instance's_name.gotoAndStop("my_label");

Finally, let me add a little confusion in the above clear (I hope!) picture.
All of this is slightly different when targeting the main timeline from an external .swf loadded on another level, or even from a movie clip within an external .swf loaded on another level. Since every .swf has it's own _root level, if you use _root.gotoAndPlay("my_start3"); from within a movie clip inside an external movie loaded on level 3, for instance, you'd be targeting a frame labeled my_start3, but one on the _root level of the external movie and not one on the main movie's timeline.
In this case, to target the main movie's timeline you would have to replace _root with _level0 as:

_level0.gotoAndPlay("my_start3");

Hope this has somewhat cleared things up! But remember, when you do get the hang of it... Flash 6 will down on you!

Regards,
new.gif
 
Yup, Old and I were in here when the switch to 5 came about and the learning curve was pretty savage for a while.

But, like you said Soul, it is kind-of geared towards a programming clientelle. As such, as you come to terms with it all, it opens you're eyes to other languages, making it easier to integrate as you go. Well worth it if you plan on sticking with it.

dave ;-)
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
thanks guys.
I've been using Flash since 2 and this is plain ridiculous. Some people are becoming obselete due to visuals turning towards programmers now. I don't have the free time to learn extended language and syntax. The small scripts I could do, but now even with flash, it's almost as if the artist and webdesigners that made flash popular have been forsaken just because Macromedia thinks we got the time to convert into programmers.
I'm done with my soapbox. Your suggestions worked and Flash4 and previous versions did leave the scene flag in the processed file.
Welcome to capitalism :-|
Thanks again.
 
Some of us old users like the changes... I am no programmer either but I have invested time in the learning process and the return has been well worth it!

Don't give up... change hurts sometimes but it can be a good thing! Ya' Gotta Love It!
sleepyangelsBW.jpg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top