Javascript :: Call A Function In An External File From The Main Page?

May 15, 2010

I'm loading from my main page an external js file, with a function.

I have a flash file in the main page invoking the javascript function.

Everything worked very well until when the javascript code was in the main file, but when I moved javascript to an external file the function seems not called anymore.

So... there is no way to move the javascript code to an external file ? Or any other solution ?

[Code]...

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Call A Javascript Function From Within An Embeded Swf File In A Html Page?

Mar 1, 2010

i want to call a javascript function from within an embeded swf file in a html page and i'm using the ExternalInterface class. i know this function must be defined in a <script> tag in the html page. however, i want to have all my javascript code in an external file, but it doesn't work. my trial file just can't find the function, although i have my external js file linked in the header.

View 3 Replies

Javascript :: Flash - Call A Javascript Function From An Embedded .swf File

Apr 16, 2009

I'd like to call a javascript function from an embedded .swf file. Specifically, I'd like to call a function in one of my externally linked javascript files from within: function loadTrack(){

[Code]...

which is in an .as file which I assume somehow becomes the swf file. How would I go about this and 're-compile' the .as file?

View 3 Replies

Php :: Find Swfobject On Included Page And Call Javascript Function?

Apr 27, 2010

I'm using the following script on my website to play an mp3 in flash.To instantiate the flash object I use the swfobject framework in a javascript function. When the function is called the player is created and added to the page.

The rest of the website is in php and the page calling this script is being included with the php include function. All the other used scripts are in the php 'master'-page

[Code]...

I have a play-button with the id '#play1' and a stop-button with the id '#stop1' on my page. A div on the same page has the id '#status1' and a little image of a speaker is in the div.When you push the playbutton, the div with the speaker is fading in and when you push the stopbutton, the div with the speaker is fading out, very simple. And it works as I want it to do.

But the problem is, when a song is finished, the speaker doesn't fade out. Is there a simple solution for this? I already tried using the swfobject framework to get the flash player from the page and call the 'IsPlaying' on it, but I'm getting the error that 'swfobject' can't be found. All I need is a little push in the right direction or an example showing me how I can correctly get the currently playing audio player (in flash), check if it's playing and if finished, call a javascript function to led the speaker-image fade-out again.

View 3 Replies

ActionScript 2.0 :: Call A Function In SWF And Pass It A Parameter From JavaScript In The Page?

Apr 29, 2004

I'm trying to call a function in frame 1 of my SWF and also pass it a parameter.

I need to do this from elsewhere on the embedding HTML page using JavaScript.

For example call the function flashFunction(foo);

Does this require a listener in Flash that listens for the call, excepts "foo" and then calls the flashFunction and passes "foo" to it?

Can this be called directly without a listener?

View 7 Replies

Javascript :: External - Call A Function By URL

Apr 12, 2011

I have an ActionScript program that I want to access some external JavaScript functions. By external, I mean that the ActionScript/swf aren't going to be loaded via the HTML/JavaScript. Everything I see recommends ExternalInterface, but that seems to imply that your JS loads your swf. Is there a way to call a JavaScript function by URL?

View 2 Replies

Call Function In Main Doc Class From External SWF?

Jul 9, 2009

I have a main.swf that loads in an external swf called home.swf. I want to be able to call a function in main.swf's doc class from the loaded swf:

Code:

function loadArtist():void { // my function }

in the main timeline of home.swf I'm calling it this way:

Code:

function timeToGo(m:MouseEvent):void {
trace("button pressed");
MovieClip(this.parent.parent).loadArtist(); }

the home.swf compiles fine but when loaded in the main.swf & the button is pressed i get this error:

TypeError: Error #1006: loadArtist is not a function.
at home_fla::MainTimeline/timeToGo()

It seems that it thinks loadArtist is a property. Ack. I've got 3 objects loaded dynamically using addChildAt(mc, 0) ...

View 2 Replies

ActionScript 3.0 :: Can't Call A Function From The Main Swf With The External Swf

Jun 23, 2010

I have one swf and this one load another one inside a MC on the stage.

Code:
function chama_movie(name:String) {
this.mcLoader.removeChild(carregador);
var carregador:Loader = new Loader();

[Code]....

View 7 Replies

ActionScript 3.0 :: Call A Function Of External Swf From Main Timeline?

Apr 30, 2010

I have 2 buttons in my main movieclip, one called "projects by client" and the other "projects by category".I have an external projects.swf which has 2 functions CLIENTS_CLICK and CATEGORIES_CLICK. The code is in the first frame of the projects.fla actions layer and not in a class.

View 1 Replies

ActionScript 3.0 :: Call Javascript Function With JSON Through External Interface?

Jun 6, 2010

I need to call a function in JS that's expecting a JSON object. Can I do this from External Interface? The company's example (after the include file url) in HTML looks like this:

//there's an js include URL earlier//
Shopwithme.Initialize({
"id":"prod1234",

[code]...

But, I need to dictate these vars through Flash. How do I call this function using External Interface?This is my EI code, but I'm obviously off base, since it's not working:

ExternalInterface.call("Shopwithme.Initialize",[{ "id":"prod1234",
"type":"2","URL":"http://www.somelink.com"}]);

What do I need to do to call this javascript?

View 2 Replies

ActionScript 3.0 :: How To Call Function Outside From Main As File

Aug 11, 2011

The Situation: I have a main.as that has a function that is worth 400 lines.

What I want to happen: I want that function to be loaded from another .as file so that my main.as does not look too long. Also, I have a lot of variables that was instantiated on my main.as that is called on that 400 line function.

The Question: How do I do this?

View 7 Replies

Actionscript :: Edit Some Flash To Make An External Javascript Function Call

May 3, 2009

I'm trying to edit some flash to make an external javascript function call, but with no success. Here's my actionscript 2.0 code:

[Code]....

I've seen lots of examples and I'm mainly confused about the use of ExternalInterface.addCallback. I don't need the javascript to return anything to flash, so is this necessary? For whatever reason, I never see the alert. Does anyone see any problems in my code? Is there some ExternalInterface library I don't have? Also, what's the BEST way to use ExternalInterface (ie; error checking, etc.)

View 2 Replies

ActionScript 2.0 :: Call JavaScript Function Written In .js File

Oct 29, 2002

How to call a JavaScript function written in a .js file from action script in MX.

View 1 Replies

ActionScript 3.0 :: Call Function In Main Timeline From Class File?

Jun 3, 2009

How can a function in main timeline be called from class file?

View 4 Replies

Actionscript 3 :: Call A Function In The Main Timeline From A Class In A .as File

Feb 15, 2012

I have some functions defined at the main timeline, and I need to call them from a class, how can I do this?

I've tried object(parent).function();

and object(root).function();

but didn't worked

those functions need to be on the main timeline because they removeChild() of the class

View 2 Replies

Javascript :: Call A Simple Function(); When Click On A Button In A .swf File?

Feb 23, 2012

I click on a button (or any object where I can write Action Script) and It should call a javascript function which I wrote in my functions.js

View 1 Replies

Javascript :: Load An External File By Flash And Then Call Its Methods?

Mar 16, 2010

I am talking about doing something like this: [URL]

from flash by using ExternalInterface probably

View 1 Replies

ActionScript 3.0 :: External Interface Call Doesn't Work With Function That Is On External JS File

Apr 17, 2012

I am using in AS3 "External Interface ". When I call the JS function that is on the same page as swf everything works fine.

I added a link in the html page to an external JS file, when I move the JS function to the external JS file the website crushes.

I would prefer to have all my JS functions on an external file so I can use them in the future in other project and it also makes it easier for me to update the site.

how to call a JS function that is on an external file from AS3?

View 6 Replies

ActionScript 3.0 :: Send Some Information To A Javascript Function On The Same Html Page As The Swf File Is In?

Nov 3, 2011

I am trying to send some information to a javascript function on the same html page as the swf file is in. I used the tutorial here on Kirupa but for same way it doesnt work.

ExternalInterface.call("fillForm('"+ l.x, l.y +"')");
ExternalInterface.call("fillForm", l.x, l.y);

These are the variations I tried.

View 1 Replies

Php :: Calling A Page With MySQL Query From Javascript Function Then Returning Results To Another Javascript Function

Jul 8, 2010

I am refactoring some code. I have a PHP page that contains a MySQL query and stores the result in a PHP variable $my_result. This result is then echoed to a Flash SWF during embedding with SWFObject. I now want to call this PHP page that makes the query from a javascript function like so - one change I have made to the PHP is that instead of storing the result in a variable $my_result I am echoing the result. Javascript function to call the PHP page and make the database query

[Code]....

View 2 Replies

ActionScript 3.0 :: Use ExternalInterface.Call To Call A JavaScript Function To Launch A Lightbox Window?

Jun 22, 2009

I'm trying to use ExternalInterface.Call to call a JavaScript function to launch a lightbox window. So far I have this:

AS3:
flash.external.ExternalInterface.call("launchLB", "" + aUrl + "");
JavaScript:
function launchLB(url) {
alert(url);

[Code]....

I get the alert but I can't get the lightbox window to display. When my as code makes the ExternalInterface call I get what looks like a page refresh and a blank browser window.

View 1 Replies

Flash - Externalinterface.call Won't Call The JavaScript Function - Firefox 3.6

Feb 10, 2011

I have a function defined in JavaScript like so:

function fadeBack() {
alert("fadeBack called");
};

I call that function from my Flash file like so:

import flash.external.*;
flash.external.ExternalInterface.call("fadeBack");

This works in both Safari and Chrome, but for some reason Firefox won't ever call the function. Still, I can't figure this out. How can I fix it?

View 2 Replies

Javascript :: Call An External Javascript On Frame Action/change?

Aug 26, 2011

i have a flash movie with 2 frames. and i would like to call an external javasscript function on frame action.

[Code]...

View 2 Replies

ActionScript 3.0 :: Call Root Level Function And Variables From External Loaded Swf File?

Jul 15, 2010

I have small issue in as3.  I am load "mainmenu.swf" file into "main.swf". through loader class. so now "main.swf" is parent "mainmenu.swf" file children how can call "main.swf " variable & function from "mainmenu.swf" .

View 2 Replies

AS3 :: Call Php Page With Javascript In It?

Mar 16, 2012

I'm trying to call a php script/page that has some javascript calls in it, from AS3.
I'm using the regular

var varSend:URLRequest=new URLRequest("http://my_www/script.php");
varSend.method=URLRequestMethod.POST;(...)

My php page has some javascript. The php passes some variables obtained in POST to my JS script, which connect to a 3rd party app. Now my problem is, i can call the script from AS3 without any problem, but when i do so, it seems like the JS is never running. My question is, if you call a php script/page in POST from flash, is the JS embed in that page running ??

View 1 Replies

ActionScript 3.0 :: Call Cleanup Function On Reload Of Page / Relode Of Swf Or Change Of Page

Nov 15, 2011

I have an swf loaded in a browswer (fire fox) and i use log on console using [code]I have initialized my swf in the document class on the Event.Added to stage.and i have a clean up function performing all the clean up/exit process in the code on the event [code]Now Doubt that this is being called/ activated/trigered as i am not able to log the start and end of the function to the console.The console log is of firebug.What exactly am i missing here? I would like to call the cleanup function on reload of page or relode of swf or change of page.How do i trigger and log it properly

View 1 Replies

ActionScript 2.0 :: Load External Swf Into Main Page And Remove When Nav To New Page

Jan 7, 2009

I am trying to load an external swf with a number of quotes into an empty movie clip on the home page. then I want it to obviously disappear when nav to any other page.

1) know that you need a loaderEmpty_mc to load the swf into

2) don't know code for how to get it to load on entering the home page

3) don't know how to cdde for leaving the home page and making it disappear

View 3 Replies

Javascript :: Use Javascript To Call Method Within A Flash (.swf) File?

Dec 19, 2010

I have a flash file that contains a package "game" which has a class "Scores" and a method setValue(). I want to write some lines of Javascript that allow me to call that method. Someone directed me to this tutorial, but I am still a bit confused.

Javascript: alert("start"); var so; so = document.embeds[0];
so.addParam("allowScriptAccess","always"); import flash.external.ExternalInterface;
ExternalInterface.call("setValue[2600]");

displays an alert to tell me that it has indeed began to execute saves the embedded flash file into a variable and sets access imports that class calls the method.I am not sure about how this class thing works? This is just the bits and pieces I was able to come up with from that site, but I don't really understand how it all works (but certainly hope to eventually).This is the site: http:[url]...how-do-i-access-flash-function-using-javascript.When I execute the code with the importation nothing happens, but the alert does come up when I don't have that statement?

View 1 Replies

Actionscript 3 :: Call A Flash Function From Javascript Function And Not Button

Nov 14, 2011

I'm using this code to call a actionscript 3 function through javascript

[URL}

and I want to call the acrionscript 3 function from a javascript function, but not on a button action.

actionscript code:
//call to javascript
ExternalInterface.call("sendToJavaScript");
//call from javascript

[Code]....

View 2 Replies

ActionScript 3.0 :: Use On A Flash Button To Call Javascript In The Head Of An Html Page?

Feb 19, 2010

I'm wanting to use a button in flash to call a javascript function that resides in my main html page.I think this can be done, but I'm not sure how to do it?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved