trying to use on (press) events that are stored in array

hi
in my movie i have stored my button data in an two arrays
one holds the draw data one holds the (goto)scene data

i can access the elements of the array
i can draw the button as intended
but i cant seem to use the use the (goto)scene array
here is my goto scene array

var aRolloverGOTO:Array = ["Scene 3","Scene 4","Scene 5","Scene 6","Scene 7","Scene 8","Scene 9","Scene 10","Scene 11"];

and here is the code that does draw but doesnt goto scene
its all on the same button

------------------------------------------------------------------------
on (rollOver)
{
      arrCount=0;
      #include "simplebutton.as"
      
}
on (release)
{
 gotoAndStop ("aRolloverGOTO[arrCount]",1);
}
------------------------------------------------------------------------
does anyone have any ideas?

thanks in advance
liseperu

liseperuAsked:
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.

hsmtpCommented:
Hi liseperu,

Try this:

on (rollOver)
{
     this.arrCount=0;
     #include "simplebutton.as"
     
}

on (release)
{
 _root.gotoAndStop (aRolloverGOTO[this.arrCount],1);
}
0
sokhodomCommented:
Well, i can only see the problem. The problem is with the gotoAndStop. This gotoAndStop require the scene name is in between the qoute i.e. gotoAndStop("Scene 4",1). However, if we use a variable name , in this case aRolloverGOTO[arrCount]", it will not work. This is because "aRolloverGOTO[arrCount]" is indeed evaluated as a string name "aRolloverGOTO[arrCount]" and not "scene 1" or "scene 4" or "scene 5" etc. So, gotoAndPlay(aRolloverGOTO[arrCount]",1), won't be able to find that path.

0
liseperuAuthor Commented:
hi sokho
i started this thread about some other aspect of my movie
it now seems that my other problem -
http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_21210384.html#12612857

has ended up with the same problem

in the other thread the example an expert gave - it may have even been you!

included the line
gotoAndPlay("user.data.scene",1);

how come that will work?
liseperu
0
Ultimate Tool Kit for Technology Solution Provider

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 now.

hsmtpCommented:
liseperu,

ok, here is solution.

Just put in every first frame of the scene - frame label, that will correspond to current scene name.
for example in scene 3 the first frame label will be "Scene 3".

Then you'll move to needed scene using just label names:

on (release)
{
 gotoAndStop (aRolloverGOTO[arrCount]);
}
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
sokhodomCommented:
Hey liseperu,
Ya that was me :).. sorry for the mistake caused coz i just look at what you typed and didn't really take a look at the problem. oKay, i've test it out on my pc. You can do it by changing the gotoAndStop to gotoAndPlay like

on (rollOver)
{
     arrCount=0;
     #include "simplebutton.as"
     
}
on (release)
{
 gotoAndPlay("aRolloverGOTO[arrCount]",1);
}
I've posted what i think here also.
http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_21210384.html#12612857
0
liseperuAuthor Commented:
hi
ok

here is the code
on (release)
{
      arrCount=0;
      trace(aRolloverGOTO[arrCount]);
 gotoAndPlay("aRolloverGOTO[arrCount]",1);
}

the trace shows that my aRolloverGOTO[arrCount] = Scene 3 but it still wont goto the next scene

arghh
how fustrating
does it work on your pc
with the same code?

thanks again
liseperu
0
hsmtpCommented:
liseperu,

gotoAndPlay("aRolloverGOTO[arrCount]",1);

It will not work, because there is no scene named "aRolloverGOTO[arrCount]".
Quotes are for strings, not for variables.

The only solution is to use frame labels as I mentioned before.
0
sokhodomCommented:
yep it works in my pc. you can download fla here:
http://www.ntu.edu.sg/home2001/n0069866/test3.fla
The difference is that i didn't pust as actionscript file. But the concept is the same.
Cheers :)
0
hsmtpCommented:
sokhodom,

Yes, it works. But I'm wondering why? :)
0
liseperuAuthor Commented:
hmmmm

i will take my vars out of a file and see if it works

thanks
0
sokhodomCommented:
You can find your solution here:

http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_21210384.html

hsmtp, You are absolutely right :) we only can use Frame name (just found out,hahha)
Cheers pal,
SokhodoM
0
liseperuAuthor Commented:
thank you both of you for all your help
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.