Invoking a function in a loaded swf file
Hi,
I have a SWF file which loads an additional SWF file, in the following method:
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
var request:URLRequest = new URLRequest(swf);
loader.load(request);
I want the parent (containing) SWF to call a "boot" function on the child SWF, so it will tell it what is the name of the LocalConnection that the parent is "connected" to. (The reason that the name of the LocalConnection is not fixed, is because I need to support multiple instances).
Any ideas?
TIA,
Vince
function onCompleteHandler(event:Event):void
callLater(callBoot);
Function callBoot():void
Object(loader.content).boot();
Note that you'll need to keep a reference to the loader in an instance variable and not a local variable
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui
Similar Messages
-
How can I make my external loaded .SWF file smoothly disappear after 15 seconds?
Hi,
How can I make my external loaded .SWF file smoothly disappear after 15 seconds? The following is the code to load an external .SWF file:
var K:Loader=new Loader();
addChild(K);
K.load(new URLRequest("clock.swf"));
K.x = 165;
K.y = 247;
K.contentLoaderInfo.addEventListener(Event.INIT, growLoader);
function growLoader(evt:Event):void {
K.width = 130;
K.height = 130;
I want to make clock.swf file disappear from the page after 15 seconds using some smooth disappear effect.
Please help.
Thanks.Something even better:
http://www.greensock.com/
Check out TimelineMax I LOVE it...
The guy that made this (and gives it away for free!) is a saint. -
ipad i have load swf file but swf is not working proper(flex 4.6) but android is fine to work how
On the MBP, in iTunes, switch to Song view and enable the iCloud Status column by pulling down View > View options and selecting the option for "iCloud Status." Close the small window. Look for any tracks that have a status of "waiting." If you see several of them disable iTunes Match while holding down the Option key. Quit iTunes, wait a few seconds, then open it again and turn iTM back on. Let it compelete the scan. Wait until all tracks that are "waiting" have a status of either "matched" or "uploaded."
On the iPad, turn off iTunes Match then launch the Music app and let the contents clear out. Power cycle the iPad for good measure, then re-enable the service once all the tracks in iTunes have been processed. -
How to detect the end of a loaded swf file
Hello Guys
This is my first time on this forum, come here with a great
hope
I have loaded a picture file (jpeg) and a video file (swf)
into the main flash file using xml
on frame 3, I load the picture and on frame 7, I load the
video, there is a stop action on frame 6
Now when the flash is executed the picture is displayed ( it
says "Click here to view the video")
when the user click the picture , the video is loaded and
starts to play ---- so far everything is working fine
now what I want to do is, once the video finishes playing (
not stoped) I want to display the picture again
can you tell me how to detect the end of an external loaded
swf files,
Please help me
Thanking You
Shriram -
How to create an xml to load swf files in sequence?
hello everyone
I'm new in web design... I know how to animate in flash, using timeline, frames, layers, twins and so on... But I want to move forward so I want to create a xml to load swf files in sequence and in loop. Each swf file has 8 seconds.You can see the example here in www.cm-seixal.pt.
I'm not a programmer but I understand how actionscript works... I hope you can help me
Cheers!
Anayou can use the urlloader class to load your xml file. use the loader's complete event and the loader's data property to retrieve the data in your xml file.
-
Loading swf files from an iPhone Air App
Although the faq says its possible ( http://bit.ly/gyxmCo ) I can't seem to load .swf files from my app.
There's no .AS code in the .swf file I'm trying to load.
PNG files load with no problems, swf's fail.
A working example would be appreciated instead of suggestions, I've spent the entire day trying out suggestions
regards,
MartijnBecause I can't see any library assets in an as2.0 file.
I've discovered that the swf fails to load as soon as you make a symbol 'export for actionscript'
probably because it will then create a class. So you can only load SWF's as simple pictures or animations, you cant use it as an asset library with multiple animations/images/sounds in it..
As for you other questions:
it doesnt matter if the file is local or on the web. same results
I created the swf file from a fla in CS4, and I'm compiling my air project that loads the swf with FlashDevelop. -
when i i design something in a file i have it aligned how i
want it, however when i load the page into another, although the
loader component is aligned, the content inside the loaded swf file
is no longer where it should be. why is that? how can i fix this?
i've just beenAlso, remember that if you load an external SWF into another
movieClip, then the _root changes. The loaded SWF will no longer be
considered _root, unless you specify in frame 1:
this._lockroot = true;
this would be the issue of your miss-alignment, if you are
using ActionScript to align objects dynamically.
If you are not using actionscript for alignment, then
Mocaloca's suggestion should be the answer. -
Loaded SWF file CANNOT be made into button DIRECTLY?
I'm experiencing a problem which may have no solution, but I
would like to know why I cannot do what I want to do.
PROBLEM:
I am attempting to load in an external SWF file and once it
is loaded, I wish to directly make the new Sprite/MovieClip into a
button. However, the newly loaded Sprite/MovieClip seems to be
resistant to be made into a button DIRECTLY. I would like to know
why this is.
WORKAROUNDS:
Here are a couple of workarounds, but again I wish to know
why I cannot do what I want to do.
1) I place the new Sprite/MovieClip into an empty Sprite on
stage and make the once empty sprite into a button.
2) Construct the external SWF in such a way so i can refer to
a MovieClip within the SWF file and make that MovieClip into a
button.
CODE EXAMPLE:
I am loading a SWF file thru a Loader and then taking the
loaded SWF file and adding it to an existing sprite on the stage. I
then attempt to make a button out of the newly loaded swf file, but
it fails to be clickable.
The following is some quick code to illustrate my problem. I
already have workarounds in place, so please let me know WHY the
following code is impossible. thanks!
==============================================================================There should be no problem with what you are trying to do. If
you want someone to look at what you've done, you have to be
careful to show that and not possibly errant code because that is
the substance of your post and what you requested be looked at--we
cannot guess what you may have done wrong in setting things up or
for code that you do not show.
I tried your code before posting my response and it worked
fine except for your error with the COMPLETE aspect. I did not
utilize any objects for loading things into, so I suggest you look
there. -
How load swf file (flash 8) with adobe captivate 3 without enter the HTML?
How load swf file (flash 8) with adobe captivate 3 without enter the HTML?
Hi SaSQuaCh69247,
Issue 1 :- Select the SWF file in library, right click, and
select update.
Issue 2 :- Actually it could be valid for Issue 1 also. It
seems like SWF file you are trying to import, does some action
like, importing another swf or connecting to server on the first
frame itself. Captivate will try to play the first frame of SWF
when you import them. Try creating a keyframe with the stop action
as the first frame in your SWF, and see if you still have the
issue.
Issue 3 :- The approach I am mentioning over here is
generally the last approach which I will take in such scenerios,
but since you have already experimented a little, so try this.
Go to C:\Documents and Settings\<user name>\Application
Data\Adobe\Adobe Captivate
Rename captivate_v20.dat as captivate_v20_org.dat.
Restart Captivate Application.
thanks -
Android kitkat issue in loading swf file from device. URL found but not working
Hi,
I am facing one issue from a very long time regarding file access in Android Kitkat version 4.4.*. I have developed Adobe Air player application for android and it is working as expected below kitkat version but not on kitkat.
I am following this methods -
NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onInvoke);
public function onInvoke(event:InvokeEvent):void
var newFile:String = String(event.arguments[0]);
trace("Received new file from Android: "+newFile)
Received URL form device in Android Kitkat -
/storage/emulated/0/.iProfData/swf/playListFiles/ContentCreation/Ma_V2_522/en/Animation/27 031_1_Welcome screen.swf
file:////storage/emulated/0/.iProfData/swf/playListFiles/ContentCreation/Ma_V2_522/en/Anim ation/27031_1_Welcome screen.swf
- Loading this URL using loader class in AS3 AIR but not working.
file%3A///storage/emulated/0/.iProfData/swf/playListFiles/ContentCreation/Ma_V2_522/en/Ani mation/27031_1_Welcome%20screen.swf
- Have used also by doing escape character but still it is not working showing file not found both SWF and mp4 case. (Mp4 case NetStream.Play.FileNotFound)
By using the above methods I can have swf or mp4 video url but when I am loading it, It is not working giving error message "File not found/ IO Error". I have read that if use escape character then it will work but I have used escape character also but it is not working.
Humble request you to please advise how can I solve this issue.
Best regards,
Sunil KumarStarting in KitKat, Google requires that applications have permission to access files on the system. You must specifically add either the READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE permissions in order to access files. Adding either one of those permissions should let you read/access files on the device. Prior to KitKat, you didnt have to have these permissions listed in the manifest to access files.
-
Problem loading swf file in flash player 9.0.47.0
Hi all!
I have a really strange problem and couldn't find any information over the internet.
The problem only occurs in flash player 9.0.47.0. It works in all the others players, newer and older..
I try to load a swf file to my web application and get the following error: "This content requires Adobe Flash Player 10.2. Would you like to install it now?"
the log file shows:
*** Security Sandbox Violation ***
SecurityDomain 'http://10.1.1.84:8080/app/jsp/flex/bin-release/LP_FLEX_project.html' tried to access incompatible context 'http://fpdownload.macromedia.com/pub/flashplayer/update/current/swf/autoUpdater.swf?0.5087 71003223956'
Warning: Reference to undeclared variable, 'out'
Warning: Reference to undeclared variable, 'out'
Warning: 'out' has no property 'text'
Warning: Reference to undeclared variable, 'cameraSettings'
Warning: 'System' has no property '_visible'
Warning: Reference to undeclared variable, 'microphoneSettings'
Warning: 'System' has no property '_visible'
Warning: Reference to undeclared variable, 'privacy'
Warning: checkPort is not a function
Warning: Reference to undeclared variable, 'xOffset'
Warning: Reference to undeclared variable, 'yOffset'
Warning: Reference to undeclared variable, 'cameraSettings'
Warning: 'System' has no property '_visible'
Warning: Reference to undeclared variable, 'microphoneSettings'
Warning: 'System' has no property '_visible'
Warning: Reference to undeclared variable, 'privacy'
Warning: checkPort is not a function
Warning: Reference to undeclared variable, 'cameraSettings'
Warning: 'System' has no property '_visible'
Warning: Reference to undeclared variable, 'microphoneSettings'
Warning: 'System' has no property '_visible'
Warning: Reference to undeclared variable, 'privacy'
Does anybody has a solution??
Thanks alot!
AssafMaybe FP9 does not support your application / swf file? How did you develop it?
-
Hello All,
I am using the following code to load a SWF file into a Flash animation. The SWF file is nothing more than a short flv video (10 seconds). Users have the option of clicking a "HOME" mc if they want to return to the main menu before the flv video is completely finished playing.
var myLoader:Loader = new Loader ();
function lipStop(event:MouseEvent):void {
var myURL:URLRequest = new URLRequest ("lipStop.swf");
myLoader.load(myURL);
addChild(myLoader);
home_mc.addEventListener(MouseEvent.CLICK, home);
function home (event:MouseEvent):void {
removeChild(myLoader)
gotoAndStop(1)
When I click the HOME mc the lipStop.swf disappears as I intend and the animation returns to frame 1, but somehow I can still hear the SWF file playing in the background. I tried the samething using a FLV playback component and the same thing happens: timeline returns to frame 1, the image diappears, but I can still hear the audio track in the background.
Any suggestions?
Thanks in advance.
Chrisif you're publishing for fp10, use the loader unloadAndStop() method. otherwise, you can use the soundmixer's stopAll() method or even better, close that stream explicitly.
-
Is it possible to load SWF files from an SQL database?
Hi all, I am very new to flash (I am primarily a C'# developer!) and I have been asked to investigate the possibility of doing the following;
Create an application that allows swf files to be uploaded and stored inside of a SQL database as binary data (Why a database is a long story!)
Allow this binary data to be extracted via a http request to be dynamically loaded inside of a web page.
Now the first part was easy. I have all of my swf's uploaded and stored inside of the database. I have code that can make a request for the binary and write it to the response, so far so good. Now this is where I am stuck.
I thought I could dynamically load the swf binary data by creating a very basic swf that simply contains a movie clip holder and for now a simple loadMovie statement. My idea being that I can could provide a url for the loadMovie statement that returns the swf binary data. This is where I have ground to a halt.
I can see the call being made from the swf, I can see the data being returned but I cannot get it to render. I remember seeing an article some time agao where someone stated that they had used this method with success but I cannot find now. Has anyone ever done anything like? Is it even possible? Am I missing something simple?
I have tried to return both the raw binary data and also used response.write but to no avail. Can anyone help?You are possibly trying to load AS3 swf into an AS2 Container at least the use of loadMovie() points in that direction. Be sure to use AS3 and target at least Flash 9 in your Loader/Main.swf. Also the AS3 concept of how to load swfs differs a lot from the old concept.
Look into the docu:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Loader.ht ml
But the biggest Problem seems to me -what you mentioned- that Loader needs a (defined) URLRepuest and since your swf files have no "real" URL and you surely don`t want to let the user directly write to your server, a workaround would be to write the BinaryStream with AIR-functionality to a local installlation directory and load it then from there. -
How to load swf files within another SWF and still maintain actionscript
Hi I was wondering how to embed an swf file inside another
swf file, If i simply import it to the stage or the library it will
become a symbol but the actionscript interactivity is lost, another
question is can I have an actionscript 2 file play within an
actionscript 3 file?
The actionscript 2 code for embedding is something like this:
don't mind the _mc titles
this.cargame_mc.onRelease = function (){
loadMovie ("Crusty Rusty's.swf", empty_mc)
empty_mc._xscale=60;
empty_mc._yscale=55;
empty_mc._x=210;
empty_mc._y=140;
Please Help its for my uni portfolio, i want to use as2, but
if i do i would lose the 3d possibility of as3, is there any way to
export an as3 file and then embed in as2, using a program or
anything? Thanks!I
I would just like to say thanks in advance because everyone
on here is so helpful!you can load an as2 file into an as3 file (using the loader
class) and the actionscript will work in both. -
Problem loading SWF file in FlashIsland
Hey,
I am trying to use FlashIsland for ABAP WebDynpro.
Unfortunately the SWF File is not loading. When I type the URL to the SWF File directly to the browser, the SWF file loads correctly.
In the header I have posted the statement: initialize="initApp()". My initApp I have implemented, too (see below).
import sap.FlashIsland;
public function initApp():void
FlashIsland.register(this);
What can be the problem there?
First I thougt it might be a problem of my Internet Explorer configuration or the customizing of the SAP System. But when I execute the WDR_TEST_FLASH_ISLAND application everything works fine there.
Thanks in advance for your help.
Kind Regards,
Thomas WeberSo,
I installed Flex Builder 3 with the Standard SDK 3.2.
Now i implemented a very simple Flex Project again:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="initApp()">
<mx:Script>
<![CDATA[
import sap.FlashIsland;
public function initApp():void
FlashIsland.register(this);
]]>
</mx:Script>
<mx:Label x="166" y="115" text="TEEEEESSSSSSSSSTTTTTT" width="399" height="161" id="LBL_TEST" enabled="true"/>
</mx:Application>
I get the same behavior like explained before. The Flash is not loading at all!
And again I cant do any right click on the page. I get an empty page loaded...
Please help me! What can be the problem?
Nice regards,
Thomas
Maybe you are looking for
-
Synching Photos to iPhone 4 w/iTunes 10.2.1.1 on a Windows 7 64-bit machine
iTunes does not synch photos if they are not on the primary disk drive. I have all my photos on a separate hard drive on my Dell to free up space on my primary drive, but iTunes would always hang up when it came to the synching photos step when I tri
-
Lightroom book upload to Blurb - "GutsSize error"
Hi, I'm trying to upload my book (112 pages) from Lightroom 5.0 to Blurb for already 2 weeks. I have tried at least 15 times, without any success- I always get the following error message : "GutsSize error". I don't have any clue what it means. I can
-
Creative zen microphoto 4GB big prob
Since a week or so, when i open the player by moving and holding the power button to on position, the only thing appear is the splash screen of creative logo and copyright 2005 and it stays there until I remove the battery, cause when I tried to clos
-
Same issue for a year now with watching Flash content, nothing has changed
One of my main gripes about Safari, is that while I am watching a flash movie in one safari window and have another safari window open typing, doing work etc., the flash video stutters in the first window (looks like it is evenly dropping frames incr
-
Down Loading the BOM & Routing Data from Production client
Hi, Is there any method to download the ALL Material BOM & Routing data in excel sheet from Production client. Thanks shiv