|
-
Hi everyone -
Situation: I have four rollover stars in a line used for grading an online document that if you rollover star 3 for eg, 1 and 2 light up as well. Easy enough. Next I want to pass a function call to some javascript external to the flash file passing forward which star has been clicked, ie
on (press) {
mystarfunction(star3);
}
Obviously this will only call a function within flash. This is where I get stuck. I know it has something to do with FSCommand, but my knowledge ends there as I've never really explored this area.
any ideas would be great
thanks
frank
-
You are correct about exploring the FSCommand function.
fscommand(command, arguments);
Arguments
command A string passed to the host application for any use.
arguments A string passed to the host application for any use.
Description
Action; allows the Flash movie to communicate with the program hosting the Flash Player. In a Web browser,
fscommand calls the JavaScript function moviename_Dofscommand in the HTML page containing the Flash movie,
where moviename is the name of the Flash Player as assigned by the NAME attribute of the EMBED tag or the ID
property of the OBJECT tag. If the Flash Player is assigned the name theMovie, the JavaScript function called is
theMovie_Dofscommand.
Player
Flash 3 or later.
Also be sure to set your publishing settings to include flash with FSCommand in the template dropdown box of the HTML publishing settings.
Also, use of the FSCommand with flash requires Java to be active in the browser as a go between flash and the browser javascript.
You can also send commands to flash via javascript as well, but that's another post :-D
-
Thanks for this - so in my case, would I use:
on (press) {
fscommand(mystarfunction, star3);
}
?
You say to replace the "moviename" with the object ID or Embed name written into the HTML file? Can anyone show me a code demo?
thanks
frank
-
Senior Member
You could do this with getURL instead of an fscommand,
in the html page that contains the movie define your javascript function
<script language="javascript">
<!--
function myStarfunction(grade) {
// do actions with the grade variable
}
//-->
</script>
in flash this could be called with
on (press) {
getURL("javascript:myStarFunction('star3');");
}
-
Hey cool - thanks, I'll give this a try, but will also endevour to learn the FSCommand too.
cheers
frank
-
FScommand to hide a flash
Hey can you help me with using the FScommand to hide a flash in HTML file? Have you done this before? You seem to have good knowledge of the FScommand and java.
Thanks,
J
-
Lifetime Friend of Site Staff
If you're using Flash 8 you can use the new ExternalInterface to make calls to javascript directly without FSCommands and you can get results back from javascript syncrhonously.
-
I am afraid I do not know of that. This whole area is new to me when it comes to using FS and javascript. I really just need to know how to pass a command to a javascript using the FS or getUrl command. I have a programmer doing the javascript part.
EX:
fscommand(______,______) Can you help fill in the blanks???? or can it be one blank?
I am trying to use the command "close_flash" as the variable to pass.
Thanks,
J
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
|