AS2 SWF loaded inside a AS3 SWF
Hi,
In a recent project I had to load a FlashPaper2 document
inside a SWF implemented in AS3. I read a couple of articles about
Darron
Shcall's article and
FlashInterface
but none of them seemed to be useful in my case.
I needed to load a FlashPaper SWF inside a AS3 and couldn't
rely on ExternalInterface since they were not two separate SWF's.
To be more clear, I was using the Loader class via a Sprite to load
the FlashPaper SWF.
Anyways, I created FlashPaperLoader.SWF implemented in AS2
which was used to load the FlashPaper SWF. This loader was able to
communicate with the FlashPaper APIs (AS2). As you can guess, the
AS3 SWF was used to load the FlashPaperLoader.swf.
What I don't understand is how come the FlashPaperLoader the
FlashPaper document SWFs can communicate with each other thru AS2
function calls when they are loaded inside a AS3 SWF, I thought
that due to VM differences, no communication is possible!
I hope I was clear, if I was, any guru insight is really
appreciated.
Cheers.
Thanks kglad,
But you still haven't answered my question. I am not looking
for solutions, my own solution works. I wanted to understand more
about the VM's.
AS3
var request:URLRequest = new
URLRequest("./FlashPaperLoader.swf");
var loader:Loader = new Loader();
loader.load(request);
AS2
var loader:MovieClipLoader = new MovieClipLoader();
loader.loadClip("./FlashPaperDoc.swf", fpContainer);
// the loader SWF used IFlashPaper APIs to communicate with
the FlashPaper SWF.
Now, the first part (AS3), all that code is interpreted by
VM2. Once an AS2 SWF is loaded a
AVM1Movie
is created and no direct communication between AS3 and AS2 is
possible. I am curious to know how come the two AS2 SWFs can
communicate with each other while inside the VM2 space.
Similar Messages
-
"stop" inside AS 2 Frame doesn't work when loaded inside AS 3 swf
Hi
Please help!!!!!!
I have a flash code where i am loading an AS 2 SWF inside AS 3. The thing is if i put the AS 2 SWF on same domain its working fine but if i put AS 2 SWF on different domain it loads the SWF properly but the "stop()" written inside the AS 2 frame doesnt work... and it keeps on playing all the frames continuously...
Here is the loading code..
var context:LoaderContext = new LoaderContext();
if(Security.sandboxType == Security.REMOTE)
{ context.securityDomain = SecurityDomain.currentDomain };
var objLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("SomeURL.swf");
objLoader.contentLoaderInfo.addEventListener(Event .COMPLETE, onSWFLoadComplete);
objLoader.load(mRequest, context);
function onSWFLoadComplete(e:Event):void
var oLoaderInfo:LoaderInfo = LoaderInfo(e.target);
var mcChild = oLoaderInfo.content;
mcChild.addEventListener(MouseEvent.ROLL_OVER, onMouseOverLoader);
mcChild.addEventListener(MouseEvent.CLICK, onMouseClickLoader);
addChild(mcChild);
Have tried
System.security.allowDomain ("*");
Thanks for the helpHi,
Actualy the "stop();" will only work when you don't use external as3 file, instead shift all your file code into frame code and remove the class name.
this is the only way i found out while developing the application.
What i think is there must be some class which we have to include to use the "stop" in the main scene fram. -
Communication from a flex app. to a swf loaded inside it at runtime
I am loading a swf (made with Flex 2) inside another flex
application using the SWFLoader as:
<mx:SWFLoader id="swfLoader1" source="Modules.swf"
width="100%" height="100%"/>
the swf ("Modules.swf' ) loads as expected, but form the
parent movie I want to be able to control (change values of
variables) parameters on the child swf (swfLoader1).
When a click a button in the host movie I want to change the
text on a label on the child movie, but it is not working for me.
I have done this:
when clicking the button call a function doStuff()
public function doStuff():void
var myMovie:* = swfLoader1.content;
myMovie.mod1_desc.text = "blah blah";
But it's not working. Then I tried
public function init():void
_loader = new Loader;
extContent.addChild(_loader);
_loader.contentLoaderInfo.addEventListener(Event.INIT,
doStuff);
_loader.load(new URLRequest("Modules.swf"));
init() is called from creationComplete on the Application
(MXML) and when the _loadr is loaded it calls the doStuff function
above. Again is not working.
Any suggestions on how to do this right?
GilbertProbably not. Otherwise lots of great malware would be delivered via Flash.
-
How can I call functions from a SWF loaded in to another SWF?
Hi there,
Please excuse my ignorance, I am very new to actionscript and flash.
I have 2 SWF's - a.swf and b.swf.
I load b.swf into a.swf with the following code:
var swfLoader:MovieClipLoader = new MovieClipLoader();
swfLoader.loadClip("b.swf", container_mc);
Now in b.swf, I have a function as follows:
public function sendData(){
trace("I ran the function!");
So I have done a lot of reading, from what I can tell I should be able to run the sendData() function from the code in a.swf, by typing:
container_mc.sendData();
but its not working. What am I doing wrong?
Thanks in advance,
AdamThanks heaps mate, after a bit of trial and error it works! Here is the code that I added:
var loadingListener:Object = new Object();
swfLoader.addListener(loadingListener);
loadingListener.onLoadStart = function(container:MovieClip):Void {
trace("The MovieClip "+container+" started loading");
loadingListener.onLoadInit = function(container:MovieClip):Void
trace("The MovieClip " + container + " has been initialized");
container_mc.test();
Marked your answer as correct :-)
Thanks again, I really appreciate your help.
Cheers
Adam -
Can Flex3 generated swf load Flash Builder generated swf?
Hi All,
My company is corrently using Flex 3 appliaction (Host application) to host other Flex3 applications (Widgets).
We load the host application and the host appliaction loads couple of widgets (using SWFLoader) that were also compiled using flex bulder 3.
My qustion is, can i load swf files that where compiled using Flash Builder my Flex3 host application swf?
Thasnk in advance,
LiorOld content cannot load content from newer versions. You can go the other way around though, so upgrade the main app to Flex 4 and you can load Flex 3 content into it
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui -
Trouble loading an external swf file implemented with AS3
I am using Adobe Flash CS3
At first, I tried
swf_mc.loadMovie("//swf file
location");
It gave me
quote:
Warning: 1060: Migration issue: The method loadMovie is no
longer supported.
USE: var l = new Loader(); addChild(l); l.load(new
URLRequest("your url"));.
Well, the given code isn't working at all.
But since it is a migration error, I thought maybe I can just
save it into Flash5 format with AS1. Then it worked with most
external swf files. However, the one I am trying to load is a swf
file with AS3, so my older version swf can't load it at all.
Anyone has any ideas about how to load an external AS3 swf
file?AS3 is a completely different beast than AS1 or 2. loadMovie
was removed from the language.
The answer to your question is two fold. First, Adobe was
kind enough to give us the code when it finds a migration issue.
var _ldr:Loader = new Loader();
addChild( _ldr );
_ldr.load( new URLRequest( "your url") );
Handling progress has also changed. I have a ContentLoader
package on my site that you're free to use that should familiarize
you with the new way that things are done in AS3.
http://sd-dezign.com/blog/?page_id=10 -
I'm having an as2 issue loading external swfs
I have external swfs loading into a main swf, and the
different subpages in the same fla but encapsualted within
movieclips and each movieclip is on a different layer in the
timeline. The trouble is that I can't disable the buttons on the
different layers so if a particular page loads all the hit states
are still on the stage even though I cant see the actual button.
This is the code I think needs to be changed I tried modifying the
for loop, but I don't know how to go about disabling those
hitstates Ex. I'm on the contact page but hit states from the home
page are causing the mouse icon to chnge when rolled over. I added
this to the for loop but it just broke the swf:
else if (id = "home")
_root.mcPages.mcSection1.home._visible = false;
I think since its externally loading I need to use relative
targeting or use _level?? instead of _rootYou may want to check this thread:
https://discussions.apple.com/message/17411662#17411662
and maybe search out the OP and ask him. -
I have a feeling that I know the answer to this. I am not
terribly savvy on Actionscript (basic sklls, not expert)..and not
in 3.0 at all!!!!!!!! I have a website that is done nearly all in
Flash with AS2.0. I recently added a video player from a video
aggregator, but their player is AS3.0.
All I could do was to build an html page and embed the AS 3
player into that. I prefer the seamlessness that Flash provides. Is
there ANY possible way to embed an AS3 swf file into an AS2
website.
I just cannot completely rebuild the entire website right now
in 3.0!!!!
Is there ANY simple solution? I cannot believe that I am the
only person who is having issues like this...Ugh!!!!
thanks for any help you can offer.you can't use an as2 file to load an as3 file and have the
as3 file work.
you can use getURL() to load your as3's embedding html file.
if you want it to look seemless, you can load into the same window
so the user will see your as2 content replaced by the as3 swf.
in the as3 swf you can put code to load your as2's embedding
html file (using navigateToURL()). so, you can go back and forth
between your as2 and as3 swfs. -
Controlling SWF loaded through MovieClipLoader
Hello AS gurus,
I have a two-level site for a portfolio where users can view
still images and videos for different projects. The top level SWF
file can be considered as the "parent SWF" and within this file,
the user navigates by choosing which project he/she wants to
explore. After choosing, the "parent SWF" loads in a "child SWF"
via MovieClipLoader of the selected content. It is within this
"child SWF" that the user can view the various images and videos
(with sound) of the selected project. To go back out and choose a
different project, the parent SWF is used and the user navigates to
and chooses another project.
The problem is that I can't figure out how to communicate
from the child SWF to the parent SWF (and vice versa)...well not
really...this is difficult to explain...hmmm... It would be better
to explain it with an example...
If you go to:
http://www.culshaw.info/junk_drawer/xdin/swf/
(1) Choose the "Examples" square (when this box zooms up, you
are presented with a way to navigate to various projects -- this
SWF that loads as the zoom up happens is what I am calling the
"parent SWF").
(2) Choose the second project, labelled "Ford : Ti-VCT" by
clicking on it (after clicking on the Ford project, the "child SWF"
is loaded via a MCL from the "parent SWF").
(3) You can see that the Ford project has 8 images and one
video that the user can view. Choose the video and ensure that it
begins to play and hit the mute button so that you hear sound
(sound is default muted. It is within this "child SWF" that the
video is NetStream(ed) and the sound is controlled. (there is a bug
with my code here so you may need to hit play/pause to get the
video going).
(4) Now, as the video is playing and you hear sound, click on
the "Other Examples" button that is located below the video player.
This button is actually embedded in the the "parent SWF" that
allows the user to navigate back up to see other projects and not
in the "child SWF" which contains all of the content. Notice that
you continue to hear the sound and that the net connection is still
streaming the video within the "child SWF". I don't want this to
happen. I want the "parent SWF" to tell the "child SWF" to stop
streaming and stop all sounds when this "parent SWF" - embedded
"Other Examples" button is pushed.
I can't figure out how to do this. Any info that may help
would be appreciated...
-johnHi,
It looks to me that the example you are going by has a main
navigation in the parent swf that is controlling which child movie
is loaded in and each child swf has its own internal navigation. If
this is what you are trying to achieve and you are using
_root.MoveClipName to target things you need to use the lockroot
code so the flash player knows what root you are talking about.
Place on the first frame of each Child swf
this._lockroot = true;
Hope this helps -
Hi,
I have a Flex swf loaded into a Flash swf.
I have made the Flex swf transparent, so that the buttons in the Flash swf are visible.
But im unable to interact with the Flash swf buttons.
My Flex swf is working happyily
The Flex swf overlays the Flash swf.
If i change the scrollRect of the Flex swf so the Flex swf is not overlaying the Flash swf i can successfully interact with the Flash swf buttons.
Any ideas?
Regards,
KyleThanks Alex,
I actually found an old post on a forum where you recommended a similar solution (mousesheld.visible = false).
This seems to work although it messes with dragging (my Popups at least).
But i can work with that for now, thanks for your help.
Regards,
Kyle -
Load AS2 swf into AS3 swf problem
I have a flash with AS3 and inside this swf i load in a AS2 swf.
to load swf works just fine, but the problem is when i load this i want to go to
a specific part of it, for example i want to go to frame 3 in the loaded swf.
i must control this from the AS3 swf, does someone know if this is possible?
thanks in advanceso can i do like this then to go to frame 3 in my loaded swf?
MovieClip(ldr.content).gotoAndStop(3); ?
sorry for being such an airhead
thanks for helping me out =)
Date: Sun, 7 Jun 2009 10:25:09 -0600
From: [email protected]
To: [email protected]
Subject: load AS2 swf into AS3 swf problem
no.
if, in your loaded swf, you have a function f1() on the loaded swf's main timeline and you load that swf using a loader (say ldr), use:
MovieClip(ldr.content).f1(); // to call f1() in the loaded swf
> -
Hi All,
I am new to this forum.
Can anyone tell me how to load as2 swf in as3?
If this is possible,can anyone give me some sample example?
Thanks
HarshalYou can talk to loaded AVM1 (AS1/2) SWF using LocalConnection. I used Grant Skinner's SWFBridge class in the past and worked very well:
http://gskinner.com/blog/archives/2007/07/swfbridge_easie.html
Kenneth Kawamoto
http://www.materiaprima.co.uk/ -
Load AS2 SWF in AS3 SWF with FlashVars
I am able to load SWF which is created using AS2 in to AS3
SWF but I am not able to pass Flashvars to it..
Does any one has any idea, how can I do that??
ThanksYou can talk to loaded AVM1 (AS1/2) SWF using LocalConnection. I used Grant Skinner's SWFBridge class in the past and worked very well:
http://gskinner.com/blog/archives/2007/07/swfbridge_easie.html
Kenneth Kawamoto
http://www.materiaprima.co.uk/ -
Loading as3 swf files into as2
im having a problem..i,e. i need to load an external swf which is in as3...and need it to be played in my as2 swf layout. with a time slider ,play, pause ,next, previous for that swf movie clip. pls give ur mail id i can sent my original files....................pls help me
pls give ur mail id i can sent my original files.................[email protected] pls help me am doing my final year college ..........download tis jpg image and convert to rar r zip file.....projectYou'r not able to load as3 files into as2 files.
-
here is the code i'm using:
var url:String = "avm1.swf";
var urlrequest:URLRequest = new URLRequest(url);
var loader:Loader = new Loader();
loaderListener(loader.contentLoaderInfo);
loader.load(urlrequest);
function loaderListener(dispatched:IEventDispatcher){
dispatched.addEventListener(Event.COMPLETE, assignSWF);
function assignSWF(event:Event){
addChild(loader.content);
here is the error i get:
It is illegal to move AVM1 content (AS1 or AS2) to a
different part of the displayList when it has been loaded into AVM2
(AS3) content.
Is there a different way to do this?addChild(loader)
Maybe you are looking for
-
It seems one cannot create a playlist containing a single item. Presumably some bright spark decided that a list has to contain more than one item to be a list: but that is illogical, and incorrect for any other list type I can think of. Perhaps the
-
My iPhone 4 is using 4.3.3 and I want to update to iSO 6.1. I can back it up and it starts to download it through iTunes but then I get an error message 0xE8000067. Tried all the things on the apple support site (checked USB port, deleted the 3 exe
-
Password Protecting a Published Project
Hello, We are using RH7 WebHelp. My department works on RH projects for a number of different departments within our company. One department (HR) has asked if we can restrict access to their materials from the rest of the company once we have publish
-
Testing Function Module before using in DataSource?
Hi Experts, After writing a Function module for Transaction DataSouce (by copying RSAX_BIW_GET_DATA_SIMPLE), is there any way to test the Function Module before using in Transaction DataSource? (to see how many records it retrieves). Also can somebod
-
I am looking for a product that will suit my needs. I have two Fiber cables consisting of 24 cores each, 1 cable will be used on 12 different networks, the other cable is a redundant path for those 12 networks. I need a switch capable of keeping thes