Embed SWF File In Flex And Interact With ExternalInterface Functions

Sep 1, 2011

I use a SWF file that exposes functions and events using ExternalInterface. Here is an example of an exposed function:
ExternalInterface.addCallback("myFunction", ExecuteMyFunction);

If I embed the file in an HTML page, I can access those functions using JavaScript. Now, I'm embedding that same SWF file dynamically in a Flex app using the mx:SWFLoader component, something like:
<mx:SWFLoader id="myLoader" source="[URL]" autoLoad="true"/>

I'm trying to access those exposed functions and events, but I can't find how to interact with those from the Flex app. I would like to be able to call a function just like from JavaScript, like:
myLoader.myFunction();
How can I access a function that is exposed by the ExternalInterface within Flex?

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Call C++ Functions Using ExternalInterface?

Oct 20, 2009

I am trying to call a C++ function from actionScript3. using Programming ActionScript 3.0 > Using the external API > Using the ExternalInterface class > Calling external code from ActionScript,  I could call function from JavaScript .
 
it will be good if i could call C++ functions directly from Action Script.

View 2 Replies

Flash :: Javascript :: ExternalInterface Works With Embed Tag But Not With Object Tag

Sep 19, 2011

The "modern" updated way to embed a flash object, according to Adobe:

[Code]...

Then it works on Firefox and Chrome (the AS function is called and works properly) - (it doesn't work in IE though). How come it doesn't work with an object tag? How "safe" it is to use the embed tag instead of the object tag? Is it not obsolete? Note, that it is definitely not a timing issue - If I call the AS function from JS from an onclick function - then the results are the same.

View 2 Replies

Javascript :: Flash - Functions Registered With ExternalInterface.addCallback Not Available?

Apr 14, 2010

I'm working on a Flash game that needs to call some Javascript on the page and get data back from it. Calling Javascript from Flash works. Calling the Flash functions from Javascript (often) doesn't. I'm using the Gaia framework.The swf is loaded in with SWFObjectThere's a button in the Flash file. On click, it uses ExternalInterface.call() to call a Javascript function. This works.The Javascript function calls a Flash function that was exposed with ExternalInterface.addCallback().Sometimes, the Javascript produces the following error: TypeError: myFlash.testCallback is not a function.

When the error happens, it affects all functions registered with addCallback(). Gaia and some of its included libraries use addCallback(), and calling those functions from Javascript also produces the TypeError.Waiting a long time before pressing the button in Flash doesn't solve the error.Having Flash re-try addCallback() periodically doesn't solve the errorWhen the error occurs, ExternalInterface.available = true and ExternalInterface.objectID contains the correct name for the Flash embed object.When the error occurs, document.getElementById('myflashcontent') correctly returns the Flash embed object.Edited to add:This issue shows up in Firefox 3.6, but not Chrome or IE8. I haven't tried older browsers.

I'm running the Debug version of the Flash player.My calls toExternalInterface.addCallback() are wrapped in a try...catch block. When the JS error occurs, the catch block is not triggered. It's a silent failure.The error occurs when testing on a webhost, with the swf loaded from the same server as the page it's on.
I set allowScriptAccess = always.Setting flash.system.Security.allowDomain("mydomain") doesn't fix the error.From my Page class:

public class MyPage extends AbstractPage
{
// declarations of stage instances and class variables

[code]....

View 8 Replies

ActionScript 3.0 :: Access Built-in Functions Not Exported With ExternalInterface.addCallback()?

Sep 23, 2010

I am trying to write C++ code to interface to arbitrary instances of flash player 10 contained in arbitrary web pages from IE. All I need to be able to do is:

1) determine if the player is playing,

2) start playback, and

3) stop playback.
 
I am searching for a way to so this programmatically, without resorting to simulating user input to the control.
 
I have played around with the IShockwaveFlash COM interface which works OK on some sites but not others (e.g. not on YouTube). I am wondering if it is possible to use IShockwaveFlash::CallFunction() with the appropriate XML string to invoke predefined functions in ActionScript that have not been explicitly exported using ExternalInterface.addCallback().
 
Or perhaps there is enough functionaly using accessibility and the IAccessible interface?

View 3 Replies

Flex :: Combine Mutiple Movie Clip Functions Into A Single Swc File Or MXP File For Flash?

Feb 17, 2010

I have to build one MXP package for Flash (not Flex). But i have multiple components, somthing like HelpSymbolMovieClips(have its on class), one image holder. etc. I need to combine there swc file into a single MXP file.How can i make a all these multi movieClip functionality in a single SWC file. Am bit confused about the structure of the component which is having multiple functions/MoiveClips. like (Image gallery components.

View 1 Replies

Flex :: Embed Swf File In Html?

Apr 28, 2011

Why Embeded html file doesnt run on ubuntu system

I am trying to embed swf file into html file but this is works in windows and mac browsers exactly. When I am trying in ubuntu ... it wont works..

View 1 Replies

Flex :: Add Classes And Functions To Loaded File?

Dec 17, 2009

I have a flex application that loads swf files and displays them using the SWFLoader object.is there a way to provide different classes and functions for the swf application to use? [code]...

View 1 Replies

HTML :: Flex - Display / Embed SWF File On Webpage?

Apr 15, 2012

I am newer with flex or .swf. I am trying to embed a .swf file but it does not displaying. If my .swf in bin folder then how does i display on page??

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL]">
<html><wicket:extend><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Chart.....</title>
[Code] .....

View 1 Replies

Java :: Embed A Jar File Inside A Flex Application?

Jan 30, 2011

I have a great idea and I want to build a flex application around a .jar file. Is there a way I can go by embedding a jar file into the flex application?

View 1 Replies

Actionscript 3 :: Embed Dynamic Audio File(s) / Use Variables In Embed?

Feb 10, 2012

Making a piano/keyboard application and trying to figure out the best way to set this up .I plan on having a directory of sounds for each 'instrument' in my assets folder (piano1/C4.mp3,piano1/D4.mpg,...)Is there a way to import/embed all of these as an array? Also is there a way I can pass a variable to this class to indicate which folder I want to import these from? Something that would be ideal

var type = "piano2"; //passed from class being called by
foreach(notes as note){
[Embed(source = 'assets/sounds/'+type +'/'+note+'.mp3')] private const C3:Class;
public var c3:Sfx = new Sfx(C3);
}

Or would it be a better idea to have a class for each of these "types" that pulls all notes?

View 2 Replies

Flex :: Interact With SWF Loader

Jul 7, 2009

I embedded a swf file in my application [code]now with the help of the flex documentation I wanted to interact with my loaded swf by creating a SystemManager.[code]But when starting the application the error#1034 occurs and says that Main__ embed_ mxml_mod_ VideoModule_ swf_856293516@33f53c1 could not be converted into mx.managers.SystemManager.

View 2 Replies

JavaScript :: How To Interact With 3D PDF From Flex

Feb 6, 2012

I'm working on a web application which displays a 3D model (Acrobat 3D PDF file) and allows users to interact with the model. I need to be able to communicate with PDF from the web page:
1) Programmatically highlight a node in the 3D PDF (given the node name) when, say, the user clicks on a list item referencing that node name in the web page
2) The reverse way, know which node the user selected in the 3D PDF so I can highlight that node name in the web page.

My questions:
a) The UI of my page is Flex. Is it possible to do this interaction directly from Flex?
b) If not, is it possible to do this from browser javascript? (which I will in turn call from Flex) I have seen an article on browser-pdf communication [URL] but am not sure if 3D objects can be accessed from external browser javascript.
c) Or does the Acrobat Reader ActiveX control expose methods to perform these operations from browser javascript?
d) Lastly, do folks have any recommendations based on their experience, on which 3D CAD viewer software integrate with browsers and enable this kind of interaction? (Apart from Acrobat 3D, I am evaluating a few such as 3DVIA Composer Player).

View 1 Replies

ActionScript 3.0 :: Mimicing The Until Functions - Load Of Global Functions In One File?

Nov 4, 2009

I'm trying to find a way to have global functions in my as project, similar to how flash does with stuff like the util functions (describeType()...), where you can just call the function wherever you need it. For example:

[Code]...

So when I call Test(), it prints out "hello world" fine. My problem comes in that I can't change the name of the Test function, and I can't add any other functions without compiler errors. Is it possible to have a load of global functions in one file, or do I have to split them up into separate files like in the example? Also, I know that I can make a Global class and call static functions like Code: Global.doSomething() but I'd like to know if there's a way to do it as flash does it (describeType(), getDefinitionByName(), etc), or rather, how does flash do it?

View 9 Replies

Flash :: Flex :: Embed A Html File Into An Air Package By Using Builder?

Jun 30, 2011

I have an Air Application which uses mx:HTML to show a html Page. This html page is located in my bin-debug and as long as i start my application out of FB it works fine.

In Project -> Properties -> Flex Build Packaging -> Package Content the test.html is selected

When I build the project by Project-> Export Release Build the HTML file is not included in the Air Package and so cannot be shown.

View 1 Replies

Flex :: Interact With Content Behind Transparent App?

Feb 23, 2010

I have a Flex application with wmode=transparent and a transparent section that allows whatever is underneath it on the HTML page to show through. In this case, what's showing through is another Flash application. This works fine, but I can't interact with the Flash application showing through.

I tried setting the z-index of the Flash app to something greater than my Flex app, and that worked, but unfortunately that solution doesn't work for my case because the Flex application has components that occasionally overlay in that area, and setting the z-index of the Flash app to be higher means those components are always stuck behind it.

View 1 Replies

Flex Can't Interact With Button In Itemrenderer

May 28, 2010

I have a list with a itemrenderer. When I put a button in the itemrenderer I can not interact with it. If I rollover the button the list item rollover is triggered but not the button's rollover. I can't click on the button either. You can see below I have a click event set in the itemrenderer and it is not called on click when I run app. Must I override rollover and click methods of itemrender? Why is it such a pain to put a button in an itemrenderer?[code]...

View 1 Replies

Flex :: Embed A Streaming .swf File Inside Another Flash Or Adobe Air Application

Sep 24, 2010

I currently have a network camera that streams video as a .swf (and also as a motion JPEG as well...) and I want to be able to embed the stream inside of either a Flash or Air project that I'm creating myself. The only examples i've been able to find though, require the .swf to be saved as a resource of the project; clearly, this is undesirable for a live stream.

Another option is to utilize the motion JPEG. I have some generated code (shown below), but unfortunately only the first image is displayed when viewed via adobe air (if I were to view it in a HTML browser, the image would automatically update, effectively showing the stream:

<SCRIPT LANGUAGE="JavaScript">
function displayImage( )
{
// Set the BaseURL to the URL of your camera

[Code].....

View 1 Replies

Actionscript :: Call Functions Inside The Swf File Loaded In SwfLoader Of Flex App?

Nov 18, 2010

I have a swf file sample.swf which has its actionscript class in Main.as. This Main.as has various objects declared as public in it. For instance lets consider an object myData of class MyData (in MyData.as).

I am loading this swf file in my AIR app using swfLoader. I want to know how do I access myData.func() using swfLoader.loaderInfo.content.

View 2 Replies

Flex :: Flex - How To Embed Xml Into Swc File

Jan 21, 2010

How can i embed and then read a xml file from and into a .swc file?

View 2 Replies

Flex :: How To Get Embedded SWF To Interact With Project Assets

Jan 13, 2011

I have a Flex project in which I am embedding a Flash SWF containing an image viewer. The SWF file I'm embedding is supplemented by an XML file, which contains a list of images to show, and an images folder containing the images. The problem I'm running into is that the embedded SWF file is unable to load the pictures. I am able to see the forward/backward navigation buttons, but there are no loaded images. When I view the SWF file outside of the Flex project it works fine. Is this because Flex isn't allowing the SWF to reach outside and access other project assets?

Here's my code for embedding the SWF:
<mx:Script>
<![CDATA[
import mx.controls.Image;
import mx.events.CloseEvent;
import mx.managers.PopUpManager;
[Code] .....

View 2 Replies

Flex :: Dynamically Add Image Objects To Display And Then Interact With Them?

Jan 13, 2010

Below is sample code from a Module I have in my Flex app. I want to dynamically create mx.controls.Image objects and add them to the display. I want the user to be able to move them (this works as below) and be able to change their z-index as well as record new X and Y coords after moving back to the database. How do I determine which object in this.getChildren() is the 'selected' item the user is working with? When I add a MOUSE_OVER event, for example, it does not work.[code]

View 1 Replies

ActionScript 3.0 :: Make One .as File Code Interact With Another .as File's Code?

Mar 16, 2010

I am trying to find out how to make one .as file code interact with another .as file's code.like, if I had one .as file that specified options of movies and then when the user clicks on a movie (loaded through xml) it uses code from another .as file to load the correct movie.

View 5 Replies

Css :: Flex 3 Embed Throws "Invalid Embed Directive In Stylesheet' Error On Linux

Mar 9, 2010

We have a flex application which compiles fine on windows box using mxmlc ant task but when we try to run the same build scripts on linux, it throws the 'Invalid Embed directive in stylesheet' error indicating it is not able to resolve the path to the image files.

Can someone pls. educate me on if there is a difference in the way the image files are looked up, in a CSS file, on windows vs linux.

Flex sdk version is 3.3. The same sdk is used on both windows and linux. Not sure if this has been fixed by any future 3.x sdks.

View 2 Replies

Flex :: Display Flash Movies Inside Application And Interact With Them?

Feb 11, 2010

Since I've never done this and the google results are quite random, I ask here: Is it possible to display Flash movies inside a Flex application and interact with them?

The scenario is as follows:

I'm developing a new application in flex Another, already completed application is given to me as SWF (or perhaps SWC, don't know any details yet) I have to insert this second application inside in my Flex application, which should be no problem afair I have to interact with this application: send and retrieve data. Don't know any further details here, too.

Will this be possible? Or is Flex only capable of displaying the SWF without the possibility to interact with it? I hope you can understand, what I want (have to...) do.

View 1 Replies

Flash :: Getting Javascript To Work With SWF File Using ExternalInterface

Oct 16, 2010

I have a SWF file emedded withing a HTML page. Trying to do a simple operation - go to and play certain frame in SWF using javascript. I'm using ExternalInterface to do this but for the life of me can't get the two to communicate. I add all the code but when clicking on the link which calls javascript, it says my flash object is undefined?

[Code]...

View 2 Replies

Flash :: Does ExternalInterface Work On The File: Protocol

Mar 9, 2011

Can anyone confirm that ExternalInterface works on the file: protocol, or point to some docs that say that it will not?

View 3 Replies

How Will Flash Work If The Container Html File And An Embed Swf File Are From Different Domains

Jan 8, 2012

Let me give the context first. A user opens a local html file which has a reference to a network url of an swf file to embed.

(1) If the embed swf requests a local image file , will Flash allow the request?
(
2) If the embed swf requests an image file on a non local url other than one of the swf file, will Flash check a crossdomain.xml file on the url?

View 1 Replies

Javascript :: Use Flex's ExternalInterface With IFrames?

Jan 20, 2010

I have a simple html doc with a flex app and an iframe side-by-side (using a 1x2 table).There is a button in the flex app that, when clicked, sets the "src" property of the iframe to a URL by using the ExnternalInterface.call method to call a javascript function "doNavClick(url)".Or that's the idea.When I comment out the iframe object declaration in the html, the call to doNavClick works (I pop up an alert to test)....yet when the iframe declaration is present, it doesn't even receive the call. It's as if the iframe has somehow broken the call dispatching mechanism.Is there a workaraound for this?The problematic code is as follows:

--- Main.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

[code].....

View 1 Replies

Javascript :: Flex ExternalInterface Callback?

Dec 5, 2011

Flex:

public function callFromJavaScript():String
{
test.label='dfdsfsdf';
return "1";
}
public function init():void {

[Code]...

I have no clue wich one are crossbrowser compatible (cant install IE to test out)I have tried multiple but i cant get them to work(in any browser), im probably using the wrong id, ive been trial & erroring for a couple of hours but i don't have anything working.(i heard there was a problem with ExternalInterface.addCallback on a local file system?, should i upload the swf? < is the flex code right& problem = javascript/html side?)

View 1 Replies







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