-
[RESOLVED] onClick command
I have such onClick command in my php file:
onClick="hideCol(4, true); hideCol(5, true);showDiv('2');return false;"
I want the same command to be executed in flash, can I do such onClick command in flash so it will trigger some javascript in php? Basically do the onClick command above but the php file must catch the command.
Thanks, Yan
-
You can add an event listener for Mouse.CLICK to whatever object you want to respond to clicks. The function can use ExternalInterface to call javascript in the html page. None of that has anything to do with php.
-
I would like to have an example
-
Bearded (M|G)od
Code:
ExternalInterface.call("hideCol(4, true); hideCol(5, true);showDiv('2');");
-
Code:
someClip.addEventListener(MouseEvent.CLICK, triggerJS);
function triggerJS(event:Event):void{
if (ExternalInterface.available){
ExternalInterface.call("hideCol", 4, true);
ExternalInterface.call("hideCol", 5, true);
ExternalInterface.call("showDiv", '2');
}
}
-
1087: Syntax error: extra characters found after end of program.
What does that mean? I've used your code 5TonsOfFlax, nothing else besides a movieClip.
-
That error message occurs if you have stuff after the closing brace in an external .as file. Are you using an external .as file, or frame script? I had assumed frame script.
-
Nothing, that was just an empty flash file.
-
If it was empty, you couldn't be using the code I posted. I'm guessing you put it in an actions layer, which makes it frame script.
There's nothing in that code which would cause that error. But you will have to add
Code:
import flash.external.ExternalInterface;
to the top.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|