Async loading of test swf is never caught by listener
Hi all,
I'm really struggling getting a testing structure in place. I need to test a sub-swf which gets loaded into a range of main applications and its methods are then invoked. Therefore, I want to setup a test initially to load in that sub-swf (before calling its functions).
However, despite Firebug revealing that the swf in question was called ok (200 return) the timeout function always eventually is invoked.
Please can someone tell me what I'm doing wrong as I've been struggling with this for over a week.
Code roughly copy-and-pasted (no errors when I run the original)...
public class loadSWFTester
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.events.*;
import org.flexunit.asserts.*;
import org.flexunit.async.Async;
private var _loader:Loader;
private var _request:URLRequest;
[Before(async)]
public function setUp():void
_loader = new Loader();
_request = new URLRequest("http://example.com/my.swf");
[Test(async, description="Swf load example")]
public function loadSwf():void
_loader.addEventListener(Event.COMPLETE, Async.asyncHandler(this, verifySwfLoad, 10000, null, handleTimeout));
_loader.load(_request);
private function verifySwfLoad(event:Event, passThroughData:Object):void
trace("[verifySwfLoad");
private function handleTimeout(event:Event):void
fail(" testLoad did not execute: "+event);
If I specify a non-existant URL then I get this error:
Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
...so the previous URLs I've been specifying must've been verified by the Flash player before failing in some respect somewhere else.
No event listeners seem to pick up on anything. I've tried adding a few extra (not in the example link I supplied previously yet) but the timeout function is the one which is always hit.
_loader.addEventListener(Event.INIT, Async.asyncHandler(this, initHandler, 10000, null, handleTimeout));
_loader.addEventListener(IOErrorEvent.IO_ERROR, Async.asyncHandler(this, onIoError, 10000, null, handleTimeout));
I've tried moving these listeners up in the [Before] block too with similar results.
Similar Messages
-
Loading an external SWF from an external SWF
Hello,
I'm somewhat caught between a rock and a hard spot on a flash
site project. Here is the situation:
I have created a parent movie (which loads all external SWFs
inside of it) that has the menu navigation built into it. However,
my client wants me to place some more links inside of the external
SWFs that lead to other pages (external SWFs) of the site. Is this
at all possible? I was hoping there is a way to tell a button in an
external SWF to make the parent movie switch between external SWFs.
Any and ALL help is very much appreciated. Thank you.
Another question: does this involve using the _parent script?
ElijahHello,
Thank you for replying. Here is exactly what I'm needing to
do:
We will call the parent file "index.swf". Inside "index.swf"
I have a "holder" for external swf files to load into when I call
on them from the main menu buttons on "index.swf". When a customer
comes to the site, the "index.swf" file initially loads
"welcome.swf". Inside of "welcome.swf", I have some images that I
want to make into links to other external swf files.
My problem is when someone clicks on one of those pictures I
want the "index.swf" file to open up the corresponding external swf
file in its "holder", where "welcome.swf" currently resides. Also,
all of these swf files ("index.swf" included) have stand-alone FLA
files, none are attached to one another. I have never worked with
"levels" before, would that be necessary in this case? I have
attached the code for the external swf loader.
I hope that gives you a better idea of what I'm trying to
accomplish.
Thanks again.
Elijah
CODE: -
My basic question is: "What are the classes which we should not use for iOS using the packager."
I have been trying for a few days trying to get a simple Flash app to run on the iPad. A very simple app (with sound!) with just 2 classes works fine (Performance is a whole other issue. We will get to that). But if I try anything else, all I get is a white/black screen on the iPad. So it would be really nice to know what classes, functions, etc we CANNOT use for the Packager.
I have fairly simple app (not as simple as 2 classes) which loads some art assets via URLRequest/Loader, puts them on the stage. Fairly common standard practice in AS3.
I've read about not able to load an external file using the Packager. So to fix the situation of loading assets, I have looked into the [embed] tag, which seems to work. I hope the blogger doesn't mind, but this page is an excellent source on what works and doesn't work with the [embed] tag in it's various flavors: http://www.richardleggett.co.uk/blog/index.php/2010/03/08/flash_builder_and_flash_pro_asse t_workflows. For example, AS3 in a swf is stripped out from an external swf using [embed].
The best way to load an external swf file for iOS seems to be using [embed] with "application/octet-stream" and load the swf through ByteArray (Option #4 in the link above). This works great on the PC. HOWEVER, on iPad, it fails. The [embed] tag works on the iPad with the other ways, so my guess is that loadBytes() does not work. Is this true Adobe/Flash guys? Can you confirm this?
My initial question is "why is this not allowed on iOS?". If it is because of the fact that it uses a Loader, can it be changed so it's not using a Loader to construct a MovieClip? I have a ByteArray with the raw swf/MovieClip data. Why can't I construct a MovieClip from it without going through Loader?
This loadBytes() failure seems to be the only thing preventing me from using the normal pipeline of Flash development in loading external assets. If there are other ways people have found, please share!
Now on to performance. Adobe, can you post some examples/samples of code which runs at decent performance? Like a "tech demo" of what is possible using the Packager running on iPad/iPhone. That would be extremely helpful for everyone. I have done a lot of the optimizing suggestions on various sites and pages ( and by Adobe http://www.adobe.com/devnet/flash/articles/optimize_content_ios.html), but I am not seeing the 30 fps performance that is MORE than possible on iPhone/iPad. Displaying and moving around Bitmaps (I don't use any vector graphics) should be blazing fast. Quake runs on iPad without any problems and that code is 10 years old. Moore's law dictates that drawing Bitmaps using CPU should be faster than a 3D engine written 10 years ago... I am trying out the new iOS 4.2 which is supposed to be "significantly" better, but I am still stuck on loadBytes().
So at this point, I am blocked on loadBytes() and my performance for a simple app which draws a few Bitmaps and MovieClips is terrible. I am hopeful some people out there have figured out some solution (there are lots of clever people out there) and I will stumble on to something. But being forced to go native Objective-C seems to be my only option at this point.
In summary, here are the questions I would like to ask the Adobe/Flash group for some more help/information/advise:
- Why is Loader not allowed on iOS? Is it a technical limitation of the hardware/os/Flash? Will it never be supported? What is the future of this class on iOS?
- Why is loadBytes() not allowed on iOS? I have the raw embedded data in memory. I don't need to make a remote call so security should not be an issue. Can I create a MovieClip without using Loader?
- Why is AS3 stripped from the timeline when a Symbol is retrieved using [embed]? Maybe this is the same reason loadBytes() fails, but if I could use [embed] and get a copy of the Symbol, that is what I need. (There are issues with the mx.core.MovieClipLoaderAsset/Asset, but it is better than being blocked by loadBytes())
- What are some apps you guys have written that we can use to compare PC vs iOS? Again, a "tech demo" or sample code of what you as experts in Packager for iOS have done which runs at decent framerate (30+fps) would be of tremendous help. If the Adobe/Flash group hasn't gotten the current Packager for iOS to handle more than 50+ 2D Bitmaps on screen running at 30+fps, that would be good to know. Please let us know what the experts and owners of your software are capable of getting the most throughput using the Packager. I'd hate to sound a bit fed up/angry, but I think you are wasting a lot of people's time and energy with a piece of software that, to me, seems like it was a bit early to release. Flash can do some great things. If it can do it on iOS, even better. But PROVE it to us that it's possible, before having your customers run into barriers imposed on us by trial and error.
Thanks.I have hardly ever seen a post here from someone at Adobe, so you may need to be patient.
Read this article, and get its associated demo files, to see some good performing tech demos:
http://www.adobe.com/devnet/flash/articles/optimize_content_ios.html
Back to your main point, loaders are working, what isn't working for you is accessing of things in the library of a successfully loaded swf, that have been set to Export for ActionScript. That means that the swf you have loaded has an ActionScript Class, to represent the library symbol. iOS Flash apps are native ARM code, and don't include the virtual machines that a browser plugin has, and so it's not able to interpret ActionScript. That may be why it would fail.
Now, I can think of at least a couple of reasons why you might want to have external swfs with elements that you want to reuse in the main swf. One would be if you're intending to make a lot of them, like say if you wanted to have an Asteroids game and the ability to use artwork from a set of different swfs. Another reason might be if you want to skin your interface, by taking specific elements from the loaded swf and using them in the main swf. That way you could have artists preparing those swfs for you, and you just include them in your package, and load the one you want.
There is a way to do either of those things. The second one can be done by having the item as a named symbol on the stage of the loaded swf. With a to-be-loaded swf named "inner.swf", that has a movieclip on its stage named "mc1", this script in the main swf would load that external swf and use its symbol on the main swf's stage, without having to make the inner swf's symbol use ActionScript:
var req:URLRequest = new URLRequest("inner.swf");
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
ldr.load(req);
function loaded(e:Event) {
var mc:MovieClip = e.target.content as MovieClip;
var innermc:* = mc.mc1;
innermc.x = 50;
innermc.y = 50;
addChild(innermc);
For the other case, you can take the item off the stage of the loaded swf and draw it into a bitmapdata, and then make as many bitmaps from that as you like. Here's the above example, only it adds the original movieclip to the main swf stage, and also creates a bitmap that looks the same:
var req:URLRequest = new URLRequest("inner.swf");
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
ldr.load(req);
function loaded(e:Event) {
var mc:MovieClip = e.target.content as MovieClip;
var innermc:* = mc.mc1;
innermc.x = 50;
innermc.y = 50;
addChild(innermc);
var bmd:BitmapData = new BitmapData(innermc.width,innermc.height);
bmd.draw(innermc);
var bm:Bitmap = new Bitmap(bmd);
bm.x = 150;
bm.y = 150;
addChild(bm);
So, the thing to learn is that a native ARM code application does not have an ActionScript interpreter in it, and if you need to do something that normally requires interpreting ActionScript, find another way to do it. -
Loading multiple consecutive .swf files in Flash 8
I have a question and hope that someone may be able to help;
this might be a piece of cake for you...
I have a container .fla movie and would like to load
consecutive external .swf files. Right now I have a play button
triggering the loading of the next movie, but what I would REALLY
like is a smooth transition from .swf to .swf using a listener so
that the next .swf will load once the previous one has finished. I
have a counter which determines the next .swf in order.
So far, my code is this:
Counter:
stop();
//SETUP OUR COUNTER
var mcCounter:Number = 0;
//THIS BLOCK IS ONLY TO HANDLE THE LOADER AND THE FIRST
MOVIE, movie0.swf
var myMCL:MovieClipLoader = new MovieClipLoader();
var loadListener
bject = new Object();
myMCL.addListener(loadListener);
myMCL.loadClip("movie" + mcCounter + ".swf", 6);
loadListener.onLoadComplete = function():Void {
_level0.play();
//-------------------------<CLIP
LOADERS>------------------------------\\
function loadNextClip():Void {
if(mcCounter < 6) {
mcCounter++;
var nextMCL:MovieClipLoader = new MovieClipLoader();
nextMCL.addListener(this);
nextMCL.loadClip("movie" + mcCounter + ".swf",6);
//LOADS PREVIOUS CLIP , WON"T GO PAST ZERO
function loadPrevClip():Void {
if(mcCounter > 0) {
mcCounter--;
var prevMCL:MovieClipLoader = new MovieClipLoader();
prevMCL.addListener(this);
prevMCL.loadClip("movie" + mcCounter + ".swf",6);
//-------------------------</CLIP
LOADERS>------------------------------\\
Any suggestions? I appreciate ANY help you can offer. I have
been unsuccessfully looking for hours online, and can't find any
examples, although it doesn't seem as if it should be the hardest
thing in the world.
Thanks!You need a monitor to know when one movie clip has completed
play. A simple
monitor could be adding onEnterFrame handler to the
container_mc when
MovieClipLoader onComplete or onInit is fired. In that
handler a test to see
when the loaded clip's _currentframe == the loaded clip"s
_totaframes.
Ex:
this.createEmptyMovieClip("container_mc",
this.getNextHighestDepth());
container_mc._x = 0;
container_mc._y = 0;
var swfNumber:Number = 0;
var swfNumberMax:Number = 25;
var swfNamePrefix = "MovieClipLoaderDetectEndOfPlay_Movie";
var mclListener
bject = new Object();
mclListener.onLoadStart = function(target_mc:MovieClip)
target_mc.startTimer = getTimer();
mclListener.onLoadComplete = function(target_mc:MovieClip)
target_mc.completeTimer = getTimer();
mclListener.onLoadInit = function(target_mc:MovieClip)
var timerMS:Number = target_mc.completeTimer -
target_mc.startTimer;
target_mc.play();
target_mc.onEnterFrame = function()
trace(this._currentframe)
if (this._currentframe == this._totalframes)
trace("Load Next Swf")
loadNextSwf()
var container_mcl:MovieClipLoader = new MovieClipLoader();
container_mcl.addListener(mclListener);
function loadNextSwf()
swfNumber++;
if (swfNumber <= swfNumberMax)
var swfSuffix = ((swfNumber<10)?"0" :"") + swfNumber;
container_mcl.loadClip(swfNamePrefix + swfSuffix + ".swf",
container_mc);
loadNextSwf()
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
"dragonlilly" <[email protected]> wrote in
message
news:[email protected]...
I have a question and hope that someone may be able to help;
this might be
a
piece of cake for you...
I have a container .fla movie and would like to load
consecutive external
.swf
files. Right now I have a play button triggering the loading
of the next
movie, but what I would REALLY like is a smooth transition
from .swf to .swf
using a listener so that the next .swf will load once the
previous one has
finished. I have a counter which determines the next .swf in
order.
So far, my code is this:
Counter:
stop();
//SETUP OUR COUNTER
var mcCounter:Number = 0;
//THIS BLOCK IS ONLY TO HANDLE THE LOADER AND THE FIRST
MOVIE, movie0.swf
var myMCL:MovieClipLoader = new MovieClipLoader();
var loadListener
bject = new Object();
myMCL.addListener(loadListener);
myMCL.loadClip("movie" + mcCounter + ".swf", 6);
loadListener.onLoadComplete = function():Void {
_level0.play();
//-------------------------<CLIP
LOADERS>------------------------------\\
function loadNextClip():Void {
if(mcCounter < 6) {
mcCounter++;
var nextMCL:MovieClipLoader = new MovieClipLoader();
nextMCL.addListener(this);
nextMCL.loadClip("movie" + mcCounter + ".swf",6);
//LOADS PREVIOUS CLIP , WON"T GO PAST ZERO
function loadPrevClip():Void {
if(mcCounter > 0) {
mcCounter--;
var prevMCL:MovieClipLoader = new MovieClipLoader();
prevMCL.addListener(this);
prevMCL.loadClip("movie" + mcCounter + ".swf",6);
//-------------------------</CLIP
LOADERS>------------------------------\\
Any suggestions? I appreciate ANY help you can offer. I have
been
unsuccessfully looking for hours online, and can't find any
examples,
although
it doesn't seem as if it should be the hardest thing in the
world.
Thanks! -
Need help loading an external SWF
I'm not very proficient in Flash, so any help will be greatly appreciated. I'm trying to load an external SWF with the following code:
T1_Bttn_BloodCar.onRelease = function() {
t1_images_mc.loadMovie("images/T1_Gallery/BloodCar_SWF/T1_BloodCar.swf");
t1_images_mc._alpha = 0;
It loads the SWF, but doesn't play it correctly when I test it. Here's how the loaded movie is supposed to look:
http://www.theroboteye.com/T1_BloodCar.html
But instead, it plays without the transitions, like this:
http://www.theroboteye.com/TRE2009b.html
I've been trying to figure this out for a few days and have tried adding "this._lockroot = true;" to the SWF I'm trying to load, but I can't get it to play correctly. Can anyone tell me what I'm doing wrong? Thanks in advance.Try using the MovieClipLoader class (loadClip method) instead of the loadMovie method. That way you can have a listener that waits for the movie to be loaded and then pull it into play, assigning actions and properties to it after the fact.
-
Loading an external .swf into an empty container
I'm loading an external .swf into an empty container.
Everything seems to work fine except when the .swf is loaded both
seems to be running extremely sluggish. The button rollovers are
slow, the page transitions..everything. I can't figure out why it
is doing this. Both .fla's have the same frame rate. Is there some
known reason why this might happen?well, we've tried that and it is actually a little bit worse.
Normally i test everything in a browser window anyway. I'm thinking
it might be a naming issue of some variable or something that is
the same for both fla's....not sure yet though. -
Loading and download SWFs for AIR apps on iOS from server
Dear
I develop app for ios using adobe air i need to loading and download swf in my server to my local device
i make it loading from server and play but i need to download it locally in device to play offline
Please Help
Thank YouIf I undestand correct, the unload() is unsuported yet, so it just hangs in the memory
In the tests I did, when I put two loads for the same swf, the app freezes, so I don´t know what you can do there.
For the "code", you just need to put the LoaderContext on the loads, something like this:
Frame 1:
var myLoader:Loader;
var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
if(myLoader == null){myLoader = new Loader(); addChild(myLoader); }
else {myLoader.unload();}
Frame 2:
myLoader.unload();
myLoader.load(new URLRequest("file1.swf"),loaderContext);
Frame 3:
myLoader.unload();
myLoader.load(new URLRequest("file2.swf"),loaderContext);
Frame 4:
myLoader.unload();
myLoader.load(new URLRequest("file3.swf"),loaderContext);
Regards,
Rogério Gonzalez -
How Air 3.7 load pure graphic swfs freely without using AOT mode
Hi Nimisha1,
I made an ios app which loaded pure graphics swfs from remote server. I cannot use AOT mode because the new pure graphics swfs increasing every day. AIR 3.5 works very well, but I wonder how to make it work in the same way in AIR 3.7?
thanks in advance,
JackieLoading a swf from remote server in Air 3.7 must be in AOT mode?
I think i should first make some terms clear to you:
AOT mode here applies to the target ipa-app-store which is supposed to published at Apple App Store.(And offcourse for testing purposes there are ipa-ad-hoc, ipa-test and ipa-debug and these all create IPA in AOT mode).
Till AIR 3.5 on iOS - It was not possible to load child SWFs(containing ABC code) neither locally or remotely. But yes pure assets SWFs can be loaded remotely and locally as well.
In AIR 3.6 on iOS- Loading of child SWFs(containing ABC code) locally was made possible. More info@ http://blogs.adobe.com/airodynamics/2012/11/09/packaging-and-loading-multiple-swfs-in-air- apps-on-ios/
And behavior for loading pure asset SWFs remain unchanged.
In AIR 3.7 on iOS-
Loading of child SWFs(containing ABC code) remotely was made possible. More info @ http://blogs.adobe.com/airodynamics/2013/03/08/external-hosting-of-secondary-swfs-for-air- apps-on-ios/
And behavior for loading pure asset SWFs remain unchanged.
But in the following screenshot I can see that publishing in AIR 3.7 is getting failed and this must be happening because some of your child SWFs must be containing ABC code and that is not getting compiled properly.
Can you please narrow down which SWF(s) is creating this problem? -
SWF loaded into MainNav SWF - Rollovers & Links Don't Work
Hi all,
This is probably a very basic question!
I have a Fla file with Text and Movie clips in it. The Text
is animated when rollover occurs and thumbnail images click and
link to the full size versions.
It works when published (Say "LatestText.SWF").
But when I call it from my Main Nave FLA/SWF, upon loading
the Text.SWF, the rollover anim doesn't happen and the picture
links don't work when clicked.
I have the latest flash player installed and the actual
weblink cursor appears as if the SWF acknowledges everything is
working, but nothing dynamic actually works.
Any Ideas? THANKS ALL! Much appreciated!I'll try to flesh it out, although I don't think there's need
for any code behaviours as they all work fine - until the info.SWF
is loaded into the main.SWF.
So i'll try my best to flesh this out:-
I have a Navigation FLA which publishes to SWF (at the moment
Allow access to Local Files - tried network).
This Nav.FLA is the main bulk of the website, it has all the
links and window panes.
I have a downloaded window pane style component which is an
autoscroller (in case this could be the problem).
I can load my info.SWF's straight into the container, by way
of an Actionscript Anim Frame (1) and when the Nav.SWF is tested or
published, it indeed loads in the smaller info.SWF no problems and
scrolls around beautifully,
The Info.SWF's I'm creating is just basically embedded
dynamic text, with a few movie clips that have Behaviours when
clicked or rolled-over.
These Behaviours do not seem to work when the Nav.SWF's
window pane loads in the Info.SWF - they APPEAR clickable (mouse
pointer changes to hand) but nothing clicks and THEN works. The
rollover animations (actioned via behaviours from LABELS - not
frame numbers) also do not work?
Any ideas from those that know to those that struggle would
be greatly appreciated! It's the first time I've encountered a
problem with my Flash website that I can't seem to find an answer
to in all my tutorials and books!
There's a challenge! -
Problems loading Adobe Flash SWF file
Our users are experienceing problems loading Adobe Flash SWF
files.
One example of a problem file is:
http://www.adobe.com/enterprise/accessibility/popup_acr8_accessibility.html
User traffic is flowing through a Cisco ASA firewall - these
problems do not seem to occur from home networks or a Netscreen
firewall. The Cisco ASA does NOT have http deep packet inspection
turned on, and any traffic initiated by clients inside the firewall
should be allowed. The symptom is that Internet Explorer will begin
to download the video, but will hang at some point along the way
(for this particular URL it hangs at about 7%). No error messages
are displayed, but the video never displays on the screen either. I
would appreciate hearing from anyone who may have run into this
before, or if someone can explain what is different about this type
of file from regular Adobe Flash, that might help figure out what
the ASA is objecting to. The ASA does not appear to generate any
log messages about denying this type of traffic either.
Thanks in advance for any help you can provide...Thanks, but I use publish/export settings with GPU hardware acceleration and flash version 11.2 (and 11.8) but nothing happening.
And why gif file is not all transparenty then I insert on lightblue background? It can't export good quality? Also I use Photoshop, After Effects, Adobe Edge Animate. And nothing happening. Egde animate file .oam is not good for old website navigation. It can't be inserted in freeshop site from navigation... I use logo file .oam just for example here - http://e-shoptagras.graphicsrim.eu
In reality I want swf file, but we don't find why logo flickering? here http://tagraseshop.graphicsrim.eu
All file's are transparenty - https://mega.co.nz/#!f8B2CD5R!J8uCJt9Sdq4Suz4HLhTHz8bzJcSWXMBIKcKZgkD3z8c
I need help! Please! -
I have not yet had time to test thoroughly, only just discovered the issue and thought I would post in case anyone already had any insights.
We have an AIR app that loads an .html file into an HTMLLoader. This .html file uses swfobject.js to load an AVM1 .swf (AS2, dev'd by a 3rd party), which in turn loads several of its own child .swf's and configuration .xml files from an assets directory local to the application.
Prior to AIR version 2.7.1.19610, this worked fine (at least, confirmed correct behaviour when using 2.5.0.16600; so it's possible it was an update in between, but this issue was only noticed after our most recent automatic AIR runtime update).
After an update of the runtime to this version, the first AVM1 .swf loads ok - it contains a preloader for its children, which reaches 100%, but then blanks out with nothing more happening. Right-clicking results in the context menu displaying "Movie not loaded..." and "About Adobe Flash Player 10.3.183.5".
Running the .html file outside of the AIR application - that is, doubleclicking and loading directly (in Chrome & IE, at least) - results in the original correct behaviour, so it does not appear to be the Flash Player version.
Our next step is to build our own AVM1 .swf's to help test, as we don't have great access to the internal workings of the ones being provided by the 3rd party. Without testing in our own AVM1 .swf's, there are no errors thrown that we have been able to see. Will update when we have time to investigate further - for the time-being, we will ensure the client remains using AIR 2.5.Hi Chris,
Thanks - will try and organise some sample code to confirm if and how it's reproducible outside of the project we've found it in, but hurtling towards some deadlines so there might be a brief delay before this is possible. If it's worth adding to bugbase before I can do this, I'm happy to do so, but I'll assume for now it's better to wait.
The quick response is much appreciated!
Cheers, John -
How can I load an external SWF into a movie clip that's inside other movie clip?
Hi.
I creating my first flash (actionscript 3.0) website but I'm
stuck with a visual effect I want to create.
I have a window on my website called contentWindow. Every
time you click a button this window is supposed to leave the stage,
load the requested content and return to the stage.
The sliding window is a movie clip with 83 frames, 21 to
enter the stage, 21 to leave the stage again, 20 for nothing (its
just to simulate the loading time) and 21 to return to the stage.
Now my goal is, when the user clicks on a navigation button,
the window exits the stage, loads an external SWF with the content,
and then returns to the stage.
I've the "window" movie clip with an instance name of
"contentWindow". Inside there is another movie clip with an
instance name of "contentLoader". The content that the user
requested should appear inside the "contentLoader".
Now, when the contentWindow leaves the stage, I get this
error message:
quote:
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at rwd_fla::MainTimeline/trigger()
If I switch
"contentWindow.contentLoader.addChild(navLoader);" for
"contentWindow.addChild(navLoader);" it works fine, but the
external SWF doesn't move with the window.
How can I load an external SWF into a movie clip that's
inside other movie clip?Hi,
Recently, I have been putting together a flash presentation.
And I am just wondering if the following might help you, in your
communication with the said swf file:
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onComplete);
function onComplete(event:Event):void
event.target.content.thinggy_mc.y -= 100;
Not the best example, but this allows you to target a mc
within an external swf file. I think if you look up this code, you
will have an answer ;)
Kind Regards,
Boxing Boom -
FAQ: How do I load an external SWF file into a parent SWF file?
A ton of Flash users visit Adobe’s we site every month wondering about how to load an external SWF file from within another SWF.
Adobe's own TechNote on the subject attempts to answer the basic question, along with some common follow-up questions, including:
How do I load more than one SWF?
How do I load a SWF into a specific location in the display list?
How do I resize the loaded SWF?
How do I set its X and Y location?
Here are some additional resources that elaborate on loading content and on working with the display list:
Sample files for the above TechNote. A set of 3 FLA and 3 corresponding SWF files, including a parent SWF and 2 SWFs that the parent loads.
Help > AS3 Developer’s Guide > Loading an external SWF file
Help > AS3 Developer’s Guide > Loading display content dynamically
Loading multiple external SWFs within a main SWF – CreativeCow.net forums
Video tutorial: ActionScript 101 – Episode 6: Adding named objects to the Stage. By Doug Winnie. An example of how to add the loaded external asset to the Stage and modify its location or other properties.
Video tutorial: Preloading in ActionScript 3.0. By Lee Brimelow. A slightly more complicated example, showing how to make the parent SWF display information about the progress of loading the external SWF.
Tutorial: Loading and unloading SWFs - FlashAndMath.com
This article provides several examples of how to communicate between a parent SWF file and the loaded SWF:
SWF to SWF Communcation via ActionScript 3.0 (by kglad)quote:
Originally posted by:
NedWebs
You now seem to want to get rid of the swf once it has loaded
and played itself thru. To do that you would need to have something
in the swf itself that triggers its removal in its last frame. The
following might work...
MovieClip(this.parent).removeChild(this);
Unfortunately I couldn't get this to work. I placed it on the
last frame of the SWF to be called - is that right?
I am not sure I am doing it correctly... -
Error 2032 loading xml from swf
Hello everyone.
I have a php site (based on Joomla! CMS). In one php page, there is a <object> element wich loads the Adobe Flex 1.5 swf file that I have developed (Slideshow.swf). This swf file is a slideshow that loads a xml file using a httpservice. The xml file contains the urls to the images to be shown. The error occurs when thw swf file tries to load the xml file, but not always.
- SITUATION 1: Visiting http://localhost/Slideshow.html or http://localhost/Slideshow.swf
The html and the swf are the files generated by Adobe Flex builder.
Navigators: IE 8, Mozila Firefox 3.5.5
--> Yes, it works!!
- SITUATION 2: Visiting http://mydomaing.com/folder1/folder2/Slideshow.html or http://mydomaing.com/folder1/folder2/Slideshow.swf
The html and the swf are the files generated by Adobe Flex builder.
Navigators:
IE 8 --> Yes, it works!!
Mozila Firefox 3.5.5 --> I don't get Error 2032, but the images can't be found. This is another problem...
- SITUATION 3: Visiting http://mydomain.com
Navigators: IE 8, Mozila Firefox 3.5.5
--> No, it doesnt' work!! I get Error 2032!!
The whole page loads. The swf loads, but when the swf tries to load the xml file, the fault event is throwed. Then I use an Alert.show. I'll give you as much information as I can:
ERROR MESSAGE (FOR SITUATION 3)
Message: faultCode:Server.Error.Request faultString:'HTTP request error' faultDetail:'Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032"]. URL: ./slideshowGallery.xml'
Name: Error
Root cause: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032"]
Error ID: 0
Fault code: Server.Error.Request
Fault detail: Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032"]. URL: ./slideshowGallery.xml
Fault string: HTTP request error
FLEX CODE
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();"
The init method:
private
function init():void{
httpService.send();
The httpservice element:
<mx:HTTPServiceid="httpService"url="
./slideshowGallery.xml"resultFormat="
e4x"fault="httpService_fault(event);"
result="httpService_result(event)"
/>
I think the handlers don't care. In SITUATION 3, the send() invocation always triggers the fault handler.
The xml file is in the same folder as the swf file (I use ./slideshowGallery.xml for the url field of the httpservice element).
This is the html code generated by the php page of my site:
<div id="ol-flashheader">
<object type="application/x-shockwave-flash" data="/templates/mx_joofree2/images/header.swf" width="700" height="240">
<param name="wmode" value="transparent" />
<param name="movie" value="/templates/mx_joofree2/images/header.swf" />
</object>
</div>
Note: header.swf is my Slideshow.swf renamed.
Ah, I have also a cross-domain policy file: http://mydomain.com/crossdomain.xml. And the following is curious. The content is:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain=www.mydomain.com />
<allow-access-from domain="mydomain.com" />
<allow-access-from domain="*.mydomain.com" />
</cross-domain-policy>
But when i visit http://mydomain.com/crossdomain.xml with IE 8 what i see is:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain=www.mydomain.com secure="true"/>
<allow-access-from domain="mydomain.com" secure="true"/>
<allow-access-from domain="*.mydomain.com" secure="true"/>
</cross-domain-policy>
But, when i visit that url with Firefox... correct, It doesn't adds the secure="true" attributes!! jajaja
Please, I need some advise to solve this problem.
Thank you very much.
When I visit the web page (www.mydomain.com) and the swf tries to loadI haven't found the solution yet, but i can give more info:
I have modified the crossdomain.xml file to set secure="false". This way, when you view it with Internet Explorer, you can see secure="false" instead of secure="true". But this didn't solve the problem.
I have read somewhere that avoiding Internet Explorer to cache files, could help. So, I have added the next line to the <header> section of the php page that contains the <object> tag that loads sthe swf file:
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
This didn't solve the problem.
Regards. -
Loading an AS2 Swf into an AS3 project
I have a need to be able to load legacy AS2 SWF's into a new
AS3 project. I know that this is not readily possible, because you
can only communicate between the two via the LocalConnection class.
So, what I have done is to create an AS2 proxy SWF. This SWF will
handle the loading of all legacy SWF's and act as a middleman to
pass the function calls between the pre-compiled SWF and the new
SWF using the LocalConnection class. The new SWF also needs to be
able to load AS3 SWF's, though.
Because of this, I have the need to detect the AS version of
the loaded SWF. If 1 or 2, then change the source to the
AS2Proxy.swf, if 3 then simply load it.
I have written the following code. My problem comes in when
the init event fires. Regardless of the compiled version of the
loaded SWF, it always traces 3 as the AS version.Alright, I solved this problem, only to come up with many
more.
To solve this problem, I needed to point to the loaderInfo
object of the UILoader's content. So:
simulation.content.loaderInfo.actionScriptVersion.
Now the proxy loads correctly, but I start getting errors
immediately. Let me paste some code to show the next steps:
First off. I immediately receive a StatusEvent error, though
the path gets sent into the proxy and loads correctly.
Next, when the complete event fires in the AS2 SWF - it sends
a completion back up to let the AS3 SWF know that it finished (and
any handling that needs to happen at that point.) I receive the
following error:
Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095:
flash.net.LocalConnection was unable to invoke callback loadSwf.
error=ReferenceError: Error #1069: Property loadSwf not found on
com.applied.flash.events.AS2Connect and there is no default
value.
Maybe you are looking for
-
How can i lock pages in solaris ?
How can a kernel program lock down memory pages for a user program in solaris ? Given the Virtual Address and size of Memory , how can a kernel program lock the pages associated with this virtual address . thnx in advance. -churak
-
AP Form Personalization - How to default Values.
Hi All, I am trying to Personalize the *"Payment Batch"* Form in AP Super User. (Navigation : Payments > Entry> Payment Batches.) My Requirement is: *"Once the Bank Account(LOV) is selected, the Pay Group(LOV) should get defaulted."* There is a ONE-T
-
Not all my photos are being displayed
To give you an example, we took 350+ photos on our recent trip to Maui. When I try to sync those photos from my Imac to my Iphone, only 54 photos are downloaded. It look like there is plenty of room for all of them. Any ideas on what the problem m
-
Sudden green cast on PS7 under XPsp3
Despite not colour profiling my monitor (I am not a pro user), I have never had any colour hassles with PS7. Until now. Suddenly everything I look at via PS7 has a green cast. First noticed it on my summer holiday pix, went aaaghh!, am now troubl
-
Edit Flash text without opening Flash?
In earlier versions of Dreamweaver, it was wasy to click on a flash text objet and edit the font and text. Now, in CS4, it defaults to the whole Flash program, which is most annoying. Is there a way to "unhinge" this function so that it works the old