Forum Moderators: open

Message Too Old, No Replies

Javascript in flash

         

Aiye

4:00 am on Sep 27, 2005 (gmt 0)

10+ Year Member



Hey, sorry if this was posted before, but I couldnt find a post about it. I was wondering how to do javascript in flash? I tried putting it into the action script, but it keeps telling me the syntax is wrong. The javascript i want to put in is this:

Alert ('message here')

I just want to make a popup message appear, but the site im going through doesnt allow javascript to be put directly into the site, but if I put in a flash, it can make the popup window that I want (a guy i saw did it, but from his source i saw that the popup is from a .swf file)

Im not 100% its javascript that he used, but if its not, could anyone tell me the code to put in the actionscript to make a popup window come up?

Richard_N

11:09 am on Sep 27, 2005 (gmt 0)



Look at macromedia flash exchange, there is an alert box component there.

Aiye

1:09 am on Sep 28, 2005 (gmt 0)

10+ Year Member



Hey, thanks for the reply...

I can get an alert in the library, and then drag it onto the stage, but I dont know how to specify exactly what it will say when it pops up. In the help, it says you can put in the action script:

Alert ('message')
Alert.okLabel
Alert.yesLabel
Alert.noLabel

but when I put that in, it says that the syntax is wrong?

benihana

4:18 pm on Sep 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



maybe post you syntax error message

Aiye

12:20 am on Sep 29, 2005 (gmt 0)

10+ Year Member



ok, heres what I put in the actrionscript for the "alert" compiled object...

mx.accessibility.AlertAccImpl.enableAccessibility();
Alert.show();
Alert('HEY');
Alert.okLabel('Sure, why not?');

and heres the output when i click "check syntax"...

mx.accessibility.AlertAccImpl.enableAccessibility();

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 2: Statement must appear within on/onClipEvent handler
Alert.show();

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 3: Statement must appear within on/onClipEvent handler
Alert('HEY');

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 4: Statement must appear within on/onClipEvent handler
Alert.okLabel('Sure, why not?');

Total ActionScript Errors: 4 Reported Errors: 4

Richard_N

6:57 am on Sep 29, 2005 (gmt 0)



Have you put this on the first frame of the main timeline?

Aiye

9:13 pm on Sep 29, 2005 (gmt 0)

10+ Year Member



Im pretty sure I did, it has the "a" for actionscript in the box