?
Solved

How Can I Insert "Java Script" into my FLASH Website Page?

Posted on 2005-04-29
9
Medium Priority
?
597 Views
Last Modified: 2012-05-07
I am trying to insert a java script into a FLASH page I have built.  How can I go about doing this?

Randy
0
Comment
Question by:rmefford
9 Comments
 
LVL 37

Expert Comment

by:Harisha M G
ID: 13896839
Hi rmefford,

Just place this block between the Web page's HTML file

<script language="JavaScript" type="text/javascript">
<!--


// Your javascript code here....


//-->
</script>

Bye
---
Harish
0
 

Author Comment

by:rmefford
ID: 13896855
Harish,

Thanks for the tip, but I don't fully understand your response.  How do I make this change in my Flash file .SFW?  Is that what you mean?

Randy
0
 
LVL 6

Expert Comment

by:iscode
ID: 13897094
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 37

Expert Comment

by:Harisha M G
ID: 13897139
>> How do I make this change in my Flash file .SFW
No.. It is a HTML javascript.
0
 

Author Comment

by:rmefford
ID: 13897362
Great, I actually have updated the HTML but how do I get it to work with my .sfw file now?  The HTML, works with my java script, but now I need to get it into my FLASH.
0
 
LVL 37

Expert Comment

by:Harisha M G
ID: 13897399
May this help ?...

http://www.devpapers.com/article/109

Quote:

The easiest, and quickest way to embed your Flash animation into your page is by calling and external JavaScript or .js file, in the precise place you wish to include your Flash movie.

0
 
LVL 37

Expert Comment

by:Harisha M G
ID: 13897401
0
 
LVL 16

Accepted Solution

by:
sam85281 earned 1500 total points
ID: 13899865
Not clear exactly what you're doing but....

I'm gonna guess you have javascript functions in the head of your html page and you're trying to call the finctions from flash???

If that's the case, you just use:

getURL("javascript:yourFunction(arguments);");

For instance if you have a function in the head of your doc to change the background color when clicking a button in flash like this:

<script language="JavaScript">
<!--
var backImage = new Array();
backColor[0] = "blue";
backColor[1] = "lime";
backColor[2] = "white";
backColor[3] = "black";
function changeBGColor(whichColor){
if (document.body){
document.body.background = backColor[whichColor];
}
}
//-->
</script>

To call this from html would be something like:
<a href="javascript:void(0)" onClick="backColor(1);">  This would change the background to lime.

To do the same thing in flash, your button action would be:
on (release) {
getURL("javascript:backColor(1);");
}

Not sure if that's what you're trying to get at, but hope it helps.

-Sam
0
 
LVL 18

Expert Comment

by:Billystyx
ID: 14035349
or, if you need some variables from the javascript propogated into your flash, then use the flashVars parameter in your object tags, along with the js function in your html page.

Can you explain what purpose the javascript will be serving?

billystyx
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question