Page 1 of 1

Can I put a Javascript link in a flash file?

Posted: Sun Aug 05, 2007 11:27 am
by legend986
I've designed a small flash menu system. I want some ajax function to be called. I wanted to ask if I can put a <a href="javascript:void()" onClick="function();"/> as the link in that flash file? Will it call the function?

Posted: Sun Aug 05, 2007 12:35 pm
by superdezign
You can give any link to Flash, but why use AJAX? ActionScript is very similar to JavaScript, and has it's own "AJAX," so to speak.

Posted: Sun Aug 05, 2007 12:38 pm
by legend986
Well, actually there's a flash file and I use Ajax to load content into a div tag. If its just links using HTML, then I can do it.. but if its Flash, i don't know how to do that...

Posted: Sun Aug 05, 2007 1:32 pm
by superdezign
I'm definitely not understanding what you're doing... Have you tried putting an onclick into it yet?

Posted: Sun Aug 05, 2007 3:07 pm
by suthie
I have never used javascript to do what you are doing... but I have used javascript and flash together many times. In my case, it was just to make popup windows with specified dimensions and such. But anyway, in my experience what works is to define the javascript function in your html page and then call it from flash. Hope that helps.

Posted: Sun Aug 05, 2007 3:28 pm
by legend986
:( yeah I've tried that... Opera gives me the following error:

Code: Select all

JavaScript - http://127.0.0.1/css/index.html
Javascript URL thread: "javascript:void(0)" onclick="sendDetails('home');new Effect.Appear('bodycontent');"
Syntax error while loading: line 1 of unknown script : 
void(0)" onclick="sendDetails('home');new Effect.Appear('bod
PS: One thing is that the Program that I use to actually build this flash file allows me to input only a link. Its something like this:
Enter the URL:____________________________
target = _blank or _parent or _self or _top

Posted: Sun Aug 05, 2007 7:29 pm
by superdezign
Then there's your answer. Just use links.

Posted: Sun Aug 05, 2007 7:32 pm
by iknownothing
superdezign wrote:Then there's your answer. Just use links.
Building on that, in your first post you used "javascript:void(0)" as your href, and "function()" as your onClick, as you may have some trouble using onClick within flash you can simply use "javacript:function();" as your href (or URL), if you didnt already know.

Posted: Sun Aug 05, 2007 10:26 pm
by legend986
I'm done :) I don't know how I missed upon that.. :) Thank you so much everyone...