Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

action script 2 not working

Community Beginner ,
Sep 03, 2009 Sep 03, 2009

New to Flash CS4, but could do basic button stuff like this in Flash MX 2004. (Haven't been doing anything with Flash in the meantime, but now have CS4 and am determined to get back into it.)

I chose Action script 2 when starting, and in the publish settings. Made some very simple buttons and used the action script assistant but cannot figure out why they are not working. i keep going around and around and getting nowhere.

would someone please take a look and advise? I am STUCK.

Please?

the file is too big to attach, but if anybody is willing to help, i'll share the file via my iDisk. Thanks so much.

TOPICS
ActionScript
2.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 03, 2009 Sep 03, 2009

First, you have to choose to open an AS2 file. If it really doesn't work, and you can't put the file here, why can't you just put the code which isn't working here?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 04, 2009 Sep 04, 2009

Like I stated, I started out by choosing an action script 2 document and chose action script 2 in the publish settings.

When i made the buttons, i converted shapes to button symbols and then named the instances on the stage. I have keyframes on the button stages.

Here is action script on the button on scene 1 to take one to the next scene:

on (release) {

gotoAndPlay("Scene 2", 1);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 04, 2009 Sep 04, 2009

This is the action script i put for making a button to open a URL in a blank window:

on (release) {

getURL("http://www.umarkers.com/aboutBuilding.html", "_blank");

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 04, 2009 Sep 04, 2009

The two examples you show can have inherent problems of their own... scenes can be troublesome to manage/navigate and are better avoided in a design, and testing url related links is better done on a server as Flash doesn't deal with them well in the editor's test modes.

To make sure you at least have buttons that function properly, try placing just a trace in one of them that isn't working...

on (release) {

     trace("button works");

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 04, 2009 Sep 04, 2009

Well, in the college class I took back in 2004, I learned about making scenes and have never come across any advice to avoid using scenes.

I forgot to mention this: when i have chosen "enable simple buttons" the buttons work just fine to take me to the scenes and play. Also, i have no compiler errors showing up. Somewhere along the line, a "get URL" worked, too... but it sure isn't working now.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 04, 2009 Sep 04, 2009

Yeah, I have heard about a few college level courses in these forums that don't teach best practices, and back in 2004 scenes might have been popular for some reason... I never use them in my own work.  But that's one thing about school versus reality... lesson plans rarely fail where real world applications do. If the trace command worked, with what you have offered for information there isn't much else I can offer.  Maybe you just need to revise the design back to where it was working.

UNlike AS3, AS2 doesn't deal out error messages as generously, so very often things are failing miserably without a word from the program.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 04, 2009 Sep 04, 2009

when i put the trace on one of the buttons, it did not show up.

Yeah, well i have learned both in classrooms and the "real world" and trust me, things don't always work in either situation. Usually, it is something -- a step, a setting or something that i'm missing -- however software can do some weird things sometime -- as can people.

You cannot write this off as a problem because i am using scenes in this design, because the buttons don't function within each scene anyway.

And why do they work when "enable simple buttons" but not when published? there must be something in the publish settings or something that i am not aware of.

Action script 3 is so foreign to me, i don't understand it at all. i can make animations.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 04, 2009 Sep 04, 2009

Buttons problems in Flash pretty much alweays boil down to a design error, not a software issue, but there's always the chance your file is corrupted.

So if the trace didn't work, you have a problem with your buttons because an "on(release)" on a button can't miss its target.  I would get the enable simple buttons out of the loop and pursue resolution without that running.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 04, 2009 Sep 04, 2009

i tried a new button and copied and pasted the trace action that you wrote. several times i got a message saying that what was on the clipboard had an error in it... but then it did paste into place, but it did not work.

i have tried turning off the enable simple buttons, i have tried choosing player 9 in the publish settings.

Is it even possible to use action script 2 with Flash CS4 and make it work or not?

Is there somebody out there willing to look at my document and see if you can see what the problem is? I'm thinking i might have to just go back to MX2004.

The fact that the action script does work in the "enable simple buttons" mode makes me think that i must be making the buttons right.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 04, 2009 Sep 04, 2009

If you can save your fla file as a CS3 file and load it to a server I can see about taking a look at it.  CS4 will work with any version of actionscript.  Have you installed the semi-recent update for CS4?  There were plenty of issues with CS4 when it was first released, which is why I avoided getting it, and the recent update supposedly takes cares of most of the more glaring issues.

IF you have MX2004, maybe you should recreate what you just tried in CS4 and see if it works or not.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 04, 2009 Sep 04, 2009

I have a few suggestions for you -- not that you asked, but hey it is a free forum with volunteers, so you get what you get!

First if you really don't know AS2 all that well, but you want to get into coding I would suggest starting with AS3. It is the future and if you have to learn new stuff it might as well be the newest, new stuff. AS3 is the future of Actionscript and Flash. It is a little more complex in some respects, but in many others it isn't that much more difficult and it really helps if you haven't learned all kinds of "bad" ideas from how AS2 was....

Next, if you decide to stick with AS2, I would suggest learning the latest ways of doing stuff in AS2. Using the on(event) type of coding is really old and it won't serve you well if you want to advance very far with your coding.Here is a great article on the transition to the newer style and why it is a good idea:

http://www.quip.net/blog/2006/flash/museum-pieces-on-and-onclipevent

After that, consider ditching buttons all together. They are really twitchy and strange and most people I know gave them up when movieclips could have button events attached to them.

Finally on the issue of Scenes, they are a great way for timeline animators to organize their content. And they are great when everything is just played back to back. In fact that is what happens to scenes, when you publish the timelines are strung together in sequence and then the "scenes" are deleted. The whole thing becomes just one big long timeline. The problems come in when you start using code to move the playhead around. The documentation seems pretty straight forward and it should work, but there are just several little tricky things where it doesn't work. Sounds can cause problems too. So if you plan to use code I always recommend that you use movieclips to organize your "scenes" and not the actual scenes....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 06, 2009 Sep 06, 2009

well, i've been struggling with this and it is not working.

i can open Flash MX 2004 and make a button that functions to getUrl and opens a webpage.

using the exact same action scripting, it will not function when i make it in Flash CS4.

Can someone please tell me if there is something i need to choose in the publish settings to make this work?

And, like i said, the simple buttons that go to next scene and play and previous scene and play will work in "enable simple buttons" mode, but not when published. so the action script must be okay... right?

So far, i am feeling like the money i spent on CS4 was a big waste.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 06, 2009 Sep 06, 2009

This may be a stretch, but have you tried restarting Flash and/or rebooting your computer?  I've run into weird things now and again, not this one in partucluar and that fixed it.  Also, you may need to reinstall Flash.

The publish settings should be the same in both versions.

As far as the buttons go, do you get the button cursor and is there a roll over state that works?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 06, 2009 Sep 06, 2009

thank you so much for taking the time to help. But i did try restarting Flash and restarting the computer, but i still have the problem.

I can get the rollover states and hot spot is evident with the cursor changing... but the buttons won't get a url or play the next scene or previous scene.

But when i have "simple buttons enabled" the play previous and play next buttons work when pushed, but not when published or test movie.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 07, 2009 Sep 07, 2009
LATEST

i have been wasting so much time with this. I did get a button to work to get a URL using action script 2, in a fresh document with nothing else but that button in it. However, it only worked after i started with an action script 3 document, then edited in the properties panel to use action script 2 after having the button work with action script 3.

Then i did all the same steps to make a new fresh document and make a button like i want in my project and it did not work no matter what i tried.

i started the project over yet again and instead of making scenes, decided to just go with one big timeline... which is going to be very long ... and i will still need to make control buttons with action script to make it go to the frames... and i cannot get action script on buttons to work. i did make a button for the get URL i needed, but the only way i managed to get that to work in the latest document was to put the action script on a frame, not on the button instance.

even though i cannot get the buttons to work in a swf file, they will work in the document with "enable simple buttons" checked.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines