Behavior generated script not working

I'm working on a project with Flash CS3 but I want to use the behaviors which work with Actionscript 2.0.

This is a simple button control with the script attached, that starts a movie.

The first frame has a stop(); on it.

When the button is left-clicked upon, the animation , it should go to and play frame 2. It's easy to make manually, but why don't the behaviours work? There is some problem with the instance, I think, but I've been unable to solve it.
//FROM ACTIONSCRIPT 2.0 BEHAVIOUR
	//DOES NOT WORK!!
	//---------------------------------
 
on (release) {
 
	//Movieclip GotoAndPlay Behavior
 
	this.square1.gotoAndPlay("2");
 
	//End Behavior
 
}
	//---------------------------------
 
 
	//CODED WITH SCRIPT ASSIST (2.0)
	//WORKS
	//---------------------------------
 
on (release) {
	gotoAndPlay(2);
}

Open in new window

button.txt
LVL 11
Jason210Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CyanBlueCommented:
My guess is that Flash is not finding the this.square1 movieClip...

Try this and tell me what you get in the Output panel...

on (release) {
 
        //Movieclip GotoAndPlay Behavior
        trace("this.square1 = " + this.square1);
        this.square1.gotoAndPlay("2");
 
        //End Behavior
 
}
0
Jason210Author Commented:
Perhaps you can just check the file?
0
Jason210Author Commented:
This is what the output gave with your code. What's your script doing by the way?

this.square1 = _level0.square1
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

CyanBlueCommented:
Doh...  The quotes...  Try this instead and let me know if it does the job...

     this.square1.gotoAndPlay(2);

Not everybody is fortunate to have CS3 if you know what I mean...  :(

CyanBlue
0
julianopolitoCommented:
Just looked your fla. It's simple:

That's occuring because you've choosen square1 in the behaviour panel, but there is no animation INSIDE square1. square1 is being used in THE TIMELINE, so you must play THE TIMELINE. Just choose _root in the behavior panel and it will work.

Juliano Polito
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
julianopolitoCommented:
Just for you to be sure of what I'm telling you, take a look at the script generated by the assist. it says gotoandplay(2) without refering to any object. Take a look at the picture attached.
example.jpg
0
Jason210Author Commented:
Thanks. I understand & it makes sense.

I'm new to using scripts in Flash, and this what I'm working on now is taken directly from a video tutorial on www.lynda.com.

The video tutorial says you should choose the instance, eg square one.

However, this mistake has helped me solve another problem - how to contorl a movie clip.

I'll award the points later when I've tested it on my PC.

0
julianopolitoCommented:
perfect.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.