ActionScript 3.0 :: Loading A SWF Into The Loader Of A Third Party?
May 4, 2009
I have a Master SWF that has several buttons on it's stage.These buttons each load a remote SWF of a clickable graphic into the Master movie's upper left hand corner. Inside these loaded clips are several clickable areas that I would like to use to load yet another movie into the bottom half of the Master clip ... so, it's loading a remote SWF onto the stage of a third party.I'm having a simple targeting problem. I'm not quite sure how to call a movie to load into a loader on the stage of a different movie clip. I'm using "parent" ... but i got something wrong:
_________________________________
var unitSwfLoader:Loader = new Loader();unitSwfLoader.x = 25;unitSwfLoader.y = 390;
function getUnitSWF(e:MouseEvent):void { unitSwfLoader.load(new URLRequest( "units/"+ e.currentTarget.name +".swf" ) ); parent.addChild(unitSwfLoader);}
[code].....
View 3 Replies
Similar Posts:
Mar 11, 2010
I am attempting to load multiple images in AS3 and I'm exploring different options on how this can be done.I would like to have to only use one Load() instance and handle the various image assignments in the onComplete handler...here is my first attempt:
var buttonLdr:Loader = new Loader();
buttonLdr.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
buttonLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadCo
[code]....
View 1 Replies
Jun 26, 2007
Sorry for the complicated topic. I got a .swf that loads in other .swfs. Rather than figuring out how to make a loader for loading .swfs I thought I'd just use a simple loader in the .swf I'm loading.
However, it doesn't work. It starts fully loaded but doesn't finish. Heres the AS:[AS]_root.stop();
PercentLoaded = _root.getBytesLoaded()/_root.getBytesTotal()*100;
[code].....
View 1 Replies
Apr 1, 2010
I want to have an AS3 app load images from url supplied by the user. But I don't want a malicious user to be able to load an SWF file in place of the image, such as with an altered extension "maliciousSwf.png". Well, not sure how big a security threat that is above and beyond the ability of the hacker to decompile swf, but I think that ideally such behavior should not be allowed.
So, is there any way to prevent this? When people allow users to load images in their Flash apps, do they somehow guard against loading of SWF? Or is this really absolutely no big deal?
View 1 Replies
Aug 12, 2009
im working on an image viewer and im loading an image to a loader and then add the loader to the stage.I want the user to be able to drag and drop the image but since it's a loader i dont know how to do it.
I tried
imageLoader.startDrag = true;
imageLoader.content.startDrag = true;
but im getting an error on both.
View 2 Replies
Nov 10, 2009
I am doing my first all out flash site without a template and tried several different ways to load a external swf file to the site vie ui loader... it works fine on my local computer but when i put it online the external swf doesn't show at all while the rest of the site does, and im not getting any error..
View 17 Replies
Apr 14, 2010
I want to change the following code being used to load my external flash swf to an empty swf so that a loader is used instead of loadmovie:
var dewsliderpath = _root._url.substring(0, _root._url.lastIndexOf("/")) + "/dewslider_ori.swf?xml=" + xml;
DewSlider.loadMovie(dewsliderpath);
[code].....
View 1 Replies
Jul 30, 2009
I've set up a swf with three buttons and when you click on one it loads a different swf and places it into a movie clip. If there's already something in the movie clip it removes it and then replaces it. The problem I'm having is if one of the swfs is very large and for whatever reason someone clicks on a different button where the swf is smaller it will load the smaller swf but continue to download the larger one and when that finishes it will load on top of the smaller one.Here is my code:
ActionScript Code:
var home:MovieClip = this;
var ldr:Loader = new Loader();
[code].....
View 9 Replies
Feb 18, 2011
I have a flash animation made on the main timeline of the SWF with a couple of layers, some functions and some keyframe labels. For example, i have a movieclip of a star that come across the screen and then trigger a dispatchEvent for the main timeline to go to frame label "next".[code]That SWF alone works perfectly. Problem come when i try to load this SWF into another one. What happen is the loader keep reloading the SWF over and over, overlapping them and the actionscript that's on the main timeline of the loaded SWF is ignored, the timeline plays continuously. Here is the code i use to load the SWF.[code]I have found a workaround by putting the entire animation inside one main movieclip and put that movieclip on the main timeline (one keyframe, one layer, no actionscript) and then load it. That way it works fine but it feel more like a patch than a solution. I would really like to know why it's bugging when you try to load an external SWF that use the main timeline with multiple layers, keyframes and actionscript.
View 1 Replies
Apr 22, 2011
I've tried adding this loader as a child of several different sprites but it only ends up in one of the sprites (must be removing from the other sprites display list automatically).How can I duplicate that image in the loader into multiple sprites?e.g. (note don't worry about making sure the icon is loaded, pretend I wanted to Event.COMPLETE before adding to
var icon:Loader = new Loader();
icon.load(new URLRequest('image.png'));
var iconA:Sprite = new Sprite();
[code]....
View 3 Replies
May 6, 2010
I'm using the following code to load an swf in a pure actionscript project (Flex Builder 3)
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, Loader_Complete);
_loader.contentLoaderInfo.addEventListener(Event.INIT, Loader_Init);
var request:URLRequest = new URLRequest("Skins/TestSkin.swf");
_loader.load(request);
[Code]..
I have seen examples online where people say these work for them but whenever I set width or height in any of these ways, the loaded swf is simply not displayed at all.
View 1 Replies
Jan 9, 2010
when I run the code there aren't any errors stopping it from compiling correctly. However when I click on my buttons i get an error saying:
Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
I'm guessing that I'm passing the variable off through the function incorrectly. I'd like it pass a string though so that I can pass the name of the file to load.
ActionScript Code:
function contentScreen(mcName):void {
var imageRequest:URLRequest = new URLRequest("mcName");
var imageLoader:Loader = new Loader();
[Code]....
View 3 Replies
Sep 24, 2004
I have a flash file with a 200 meg video file in it. I want to run a pre-loader and indicate the file is loading. I have a stop action script built into my first keyframs and on a seperate layer the following action script:
onClipEvent (load) {
total = _root.getBytesTotal();
}
onClipEvent (enterFrame) {
loaded = _root.getBytesLoaded();
[Code]...
View 1 Replies
Aug 12, 2009
I am creating an image gallery where the user can select from several thumbnail images. Once selected, the thumbnails will enlarge and load the full sized image. My problem is that while the user is waiting for the full sized image to load, he may decide to close that image and view another image. I am trying to find a way to stop a loader from loading. Here is the code I have used. My problem is that even though the user has clicked on the unloadBtn, the loader continues to load the file. Is there a way to disable that?[code]...
View 3 Replies
Jul 17, 2009
I have a loader, and it doesn't seem to be loading my content when I am viewing it on my website. However, when I open up my loader.swf in a browser, it loads up my content once it is done loading.
Loader AS3:
var loader = new Loader();
loader.load(new URLRequest("slideShow09.swf"));
[code].....
View 3 Replies
Mar 28, 2011
Part of my UNI degree is covering AS3 and I'm having to build a game using Flash.
I have hit a problem trying to load a new SWF after unloading the current one that is auto loaded at runtime using the loader. I have a button in the 1st SWF that unloads the current one successfully but I'd now also like to get that same button to load up an alternative one.
My host file has the following code:
import flash.display.Loader;
var startGame:Loader = new Loader ();
addChild ( startGame );
startGame.load ( new URLRequest ("interface.swf"));
My loaded SWF ("interface.swf") has the following code to unload it when required using the button:
function closeInterface(e:MouseEvent):void {
MovieClip(parent.parent.parent).startGame.unloadAn dStop();
}
how to load up the next SWF at the same time
View 2 Replies
Sep 27, 2004
I am creating an interactive CD ROM that has a flash file with a 200 meg video file in it. I want to run a pre-loader that will indicate "loading..." and indicate the file is loading. I have a stop action script built into my first keyframe and on a seperate layer the following action script:
[Code]...
When I go from scene 1 to scene 2 and load the movie, there is a 4 - 5 second delay before I get my Loading text. The file then loads rather quickly and the video file plays. I know this is a big file to load into memory from a CD, but would like the "Loading..." to display immeidately, so the user will know what is going on. Does anyone know why I am geting this delay or how to overcome it? Again, this is not an internal job or running from a web server. It is loading on a local client from a CD ROM drive.
View 1 Replies
Jul 28, 2010
Does anyone know of a easy to install photo gallery. I'm assuming it would have to be flash. I want to implement it on my own site. I am looking for the one that is thumbnails,and when you click a thumbnail, it expands and you can navigate through the other photos.
View 3 Replies
Jan 17, 2010
I'm trying to load images using the loader class but it doesn't seem to ever trigger the complete event (in this case anyway). The images are only 16x16px images from the local machine, so it should take no time at all to load. I use the totalImages variable as a counter; as an image is loaded, it subtracts 1 from it. Once it is 0, all images are loaded. I can create an instance and it goes as far as tracing "Begin loading images", but that's it. No errors in the console either.
PHP Code:
package lib{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Loader;
import flash.geom.Rectangle;
import flash.net.URLRequest;
import flash.events.Event;
public class Frame extends Bitmap{
[Code] .....
View 2 Replies
Feb 2, 2010
I'm working with Loader class in as3 and there comes some really strange problem. I have two swf files, one loading the other. In the first one, I have codes like this:
var loader:Loader=new Loader();
var context:LoaderContext=new LoaderContext();
context.applicationDomain=ApplicationDomain.curren tDomain;
var req:URLRequest=new URLRequest("Untitled-1.swf");
loader.load(req);
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE,onCPL);
function onCPL(e):void{
trace("finish");
addChild(e.currentTarget.content);
}
And the second one, with the name "Untitled-1.swf", doesn't seem to work in the first one. I find out that as long as there are ANY codes in the second swf file, the first one will repeat tracing "finish" endlessly.
View 1 Replies
Nov 22, 2010
The SWF loads itself almost entirely before even displaying Frame 1 (the pre-loader). Said pre-loader exists in it's own scene; when this scene is exported on it's own, the file size is 1.6 megs (the full export of all scenes is 1.9 megs). There is VERY little content in the preloader, in fact, a blank first scene exported on it's own is ALSO 1.6 megs. There is, however, a lot of content throughout the rest of the file (music, graphics, font, all embedded at the request of a client).It looks sort of like it's trying to ensure that some arbitrary amount of the resources are present before the first frame loads.
I used to be deep into Flash way back in the CS3 days, but haven't touched it since; the result is I am fairly familiar with AS3 but CS5's new features (many of which seem to replace entirely code-oriented methods with point and click methods) often times make me scratch my head, so you'll have to forgive me if this is the sort of 'five times a week question' y'all are numb to by this point.but I'm still not entirely sure.I've already scraped every last little bit of that awful TLF text stuff from the project, and I've fiddled with the action script settings but haven't had any luck.I'm not exactly sure what code to post here, as little of it seems relevant (after all, the problem appears to be happening before anything I've written runs). Please, though, if there's anything I can do to make this more clear, I'm totally willing to oblige.
View 3 Replies
May 25, 2009
I am trying to load in 5 pictures but 2 of those pictures need to be added multiple times to the same scene. For example you would use Loader to load one tree but would show that tree 9 times. The problem I am experiencing is that each object loads fine once but objects that are the same with different x and y values are placed at the last location that was set in the loop.
for(var i=0; i < LoadedXml.resources.resource.(@type==LoadedXml.resources.resource.@ty pe[fileCount]).@count; i++) sprite.name = LoadedXml.resources.resource.@type[fileCount] + i; sprite.x = LoadedXml.objects.object.
[code]........
View 1 Replies
Apr 22, 2010
I'm having trouble with a simple loader not loading an external swf file.I have a set of menu buttons (created from a class) that store the swf file name. When these are clicked they run a function that supposed to load the swf file but for some reason it doesn't (but maybe it does load it, just not display it). So here's the code:
Code:
var urlLoader:Loader = new Loader();
var pageHolder:Sprite = new Sprite();
[code].....
View 3 Replies
Nov 13, 2011
I've recently made the switch from as2 to as3 and am still struggling to get my head around one aspect in particular. I've managed to load one external swf into a blank file via the script
import LoadDisplayObject;
var loader:LoadDisplayObject = new LoadDisplayObject("button_01.swf", true);
loader.addEventListener("displayObjectLoaded", onComplete, false, 0,
[Code]....
.....however I'm struggling with the script to make a swfs load into a space when one of my 3 buttons is clicked....
My page currently has three buttons (button_01, button_02 and button_03) and in a local folder three separate swfs with the same names which I wish to load in, when the appropriate button is pressed.
I have managed to get them to load in using a tutorial...however they load over the top of each over...far from ideal. From research on the internet I've found a range of different script...but I just can't find anywhere I can find script to make this work..hence why I have turned to here.
Any help much appreciated...thanks in advance.
View 9 Replies
Jan 27, 2009
I loaded 5 JPG's into specific locations of an array via the URLRequest. So now when I trace my array:
[Code]...
THE PROBLEM: when I scan getXMLlinksArray and see that its NOT null, and i try to addChil to xmlImgHolder and then to spriteHolderArray, I just get a blank space. The debuger is showing that spriteHolderArray contains some loader info and the appropriate URL up until I load it with the existing loader from getXMLlinksArray. Then it says it doesn't have any conentedLoadedInfo.
View 1 Replies
Aug 7, 2009
Is there a way to check whether a loader object is in the process of loading something? I need to create an if statement that checks if the loader has an open connection. So far, what I thought of is:
ActionScript Code:
if(loaderInstanceName.contentLoaderInfo.bytesLoaded > 0)
{
// do something
}
Here, I'm just assuming that if bytesLoaded is greater than 0, than it's probably loading something. But I don't think it will revert back to 0 after the loader finishes loading an external resource. So after that, bytesLoaded will always be greater than 0 even though it isn't in the process of loading anything. Is there any other property that I can use which says whether the loader object has an open connection?
View 2 Replies
Jul 19, 2011
I have a background symbol that does the loading external jpg job, and a engine as3 that loops 2 backgrounds continuously on the screen. However, only one background can load file although they "new" from the same symbol. To test this urr... phenomenon, I exchange the order of "new" code of 2 backgrounds, then whichever on top will perfectly load the jpg file and the other will remain blank. has anyone faced this problem before? or knowing how to solve it? this external loading is really painful to me from the beginning.
[Code]...
so as you can see, I put the B2 = new fBG() prior to B1=new fBG(), then I can see B2 but not B1 and if I exchange the order, I can see B1 but not B2. That's the problem!
View 2 Replies
Nov 25, 2004
I am using a loading bar with % (percentage) . Everything seems to be working properly but its giving a little problem , it load 25% and then shows the loading bar. That mean while loading till 25% of the movie the is completely blank. Which is quite annoying and recognized as a bug. Required help from the actionscripting expertise. For further reference I have uploaded the site on this address : http:[url]....
The script I am using
1st frame
PHP Code:
txtPercentage = Math.round((_root.getBytesLoaded()/_root.getBytesTotal())*100) add "% Loaded"; tellTarget ("loader") { gotoAndPlay(Math.round((_root.getBytesLoaded()/_root.getBytesTotal())*100)); }
2nd frame
PHP Code:
if (_root.getBytesLoaded() == _root.getBytesTotal()) { nextScene(); } else { gotoAndPlay(1); }
And a instance name : loader with containing 100 frames loading bar animation.
View 8 Replies
Oct 4, 2006
Here is the thing : on rollover on thumbnails ( buttons)its preview has to appear on the top of it.My corrected code works fine exepted that my swf don't load in a good way..they load at 60 kms from the thumbnail...and in a distorted size!I don't get it.I turn the thing in all ways but it is getting worth...What is my mistake?Code for each button ( thumb)
on (rollOver) {
_root.caption._visible = 1;
_root.caption.image_mc.loadMovie("images.swf");
[code].....
View 1 Replies
May 30, 2009
how do you tell a loader to stop / cancel what it is currently loading? (or is it even possible?) i have a set of navigation buttons, which when clicked, will load an external swf on to a movieclip called "pagesHolder" thats on stage... this works fine, i have even added...
[Code].....
to make sure that only 1 swf can be seen at a time and they wont overlap each other when you click on the different buttons... however, when you click on another button before the previous swf finishes loading, then you will begin to have problems.. it will load another swf, without first cancelling the previous swf from loading.. and this can be seen in the bandwidth profiler(the items being loaded begin to stack up as i keep clicking on the buttons again and again)..
below is the code im using.. ive omitted the unimportant parts... the loadPage function will begin when a button is clicked...
[Code].....
View 4 Replies