FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Flash - Why won't this work?





Loghete
I'm making a game in Flash MX 2004, my first. But this piece of code wont work:
(Action for Button)
Code:
on (release) {
gotoAndStop(3,1);
}


I want it to go to Scene 3, Frame 1 if you press a button.

This dialoge pops up when I try to run the game:

Quote:
**Error** Scene=Scene 2, layer=Choose, frame=1:Line 2: Scene name must be quoted string
gotoAndStop(3,1);
Reign
Try this
Code:
on (release) {
gotoAndStop("3","1");
}


The error says it all?
Loghete
No, that doesn't work.. Sad
The error is gone, but when you click the button, nothing happens.

Thanks for answering, through.
Gieter
Maybe you should give your scene a name (if that's possible), and then put that name between the parentheses, since the argument needs to be a quoted string.
Reign
Gieter wrote:
Maybe you should give your scene a name (if that's possible), and then put that name between the parentheses, since the argument needs to be a quoted string.


a string can be anything, as long as its between the quote so thats not the issue
the problem is where you put the actionscript and what kind of symbol it is...

I usually don't work with on release but I think you have to put it on the symbol and I think if you use the code that way it has to be a button...

I ussually work with one layer of actionscript in my whole movie. and never use buttons.
if you want to make a button just make a movieclip a give it an instance name like "button_mc" and then call it in the actionscript layer like so.

Code:
button_mc.onRelease() = function() {
this.gotoAndPlay("3","1");
}
Loghete
Hmm..
It works if I put it like

Code:
on (release) {
nextScene();
}


But then I can't jump to a specific scene.
ranzon
uhm, it's a loooong time since i've coded flash, but doesent selectScene() works??
Loghete
No, there is no action like that
ranzon
ok.. it was a long time since i coded this type of thigs (about 1 - 2 years)

i just have created banners, ande some web pages in flash
Related topics
What software do you use to design?
Does Your Computer Have A Name ?
website in flash
Why the Democrats don't have any great leaders either..
Flash Theft Auto
Flash : when use it, when dont use it
Flash Drive Problem
Flash....for Windows xp
A debate of religion, science, and more
Tag-A-Long To My Introduction Post
Best Gaming System is best
BBCode Unleashed
Flash Programmers Needed: Work on Action script "Real d
Why can't I get Google Analytics to work with Blogger???!!!
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.