ActionScript 3.0 :: Duplicating Swf's That Are Loaded In From An External URL?

May 5, 2011

I'm working on an online flash gaming platform. We load all our graphics in externally from a library. I want to be able to load something in, then duplicate it for reuse.

So, I came across senoculars example code for duplicating DisplayObjects. This is where im getting problems. Some of the loaded assest have a few bits of timeline code (basically stop() on animated parts which have multiple animations. also, there are locators in there which are used for the collision detection engine, and these have this.visible=false commands in them).

When i load in a graphic asset, everything works fine- all timeline code executes, the loaded in swf behaves exactly how i want it to. When i duplicate it, buried timeline code is being ignored. Also, even more bafflingly- until i put some kind of timeline code on the top layer of the movieclip that is being imported and duplicated, the duplicated display object wouldn't display at all when added to the stage. (just putting a stop or trace at the very top layer made it work)So i do something like this to load a swf in, and duplicate it

Code:
var myDoAfter = function(mcLoader:Loader)
{
loadedGraphic = mcLoader.content
var newClone = duplicateDisplayObject(loadedGraphic)

[code]...

I've waffled already, and have tried to keep the code brief. Im sure some people are going to say 'never put code on the timeline in AS3' which is probably legitimate (its not all my doing).Still, i am intreagued to suss it out. Is it that, using this method of duplicating (ie getting the constructor of the thing im trying to duplicate), timeline code is simply going to be ignored?

why can't i duplicate something unless it has some timeline code at the top level? Even when it doesnt, the initial load of the asset works correctly- i can add the original to the stage, but its clones seem to be empty.Might it be something to do with the casting of the thing loaded in? (ie that Loader.content is going to be a displayObject rather than a MovieClip) ?

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Duplicating And Manipulating Loaded SWF?

Nov 12, 2010

I am trying to make a card game.

The main fla file loads an external swf file that is a movie clip that has the card art images (one card art on each frame)

This works good and I can view the loaded swf on the stage.

public function FinishedLoading(loadEvent:Event):void {
LoadedMovie = MovieClip(loadEvent.currentTarget.content);
addChild(LoadedMovie);
}

What I want to do in another function is to duplicate the load swf, so that I can have 52 of the same object, each with a different picture. I need to know how to create an instance of the loaded swf.

I would like to control each instance of the loaded swf by telling each one independently of each other to go to and stop at a specific frame such as 3 or 17, or 43, based on what card is needed at that time.

This code creates an error:

var NewCard:MovieClip = new LoadedMovie();

View 1 Replies

ActionScript 2.0 :: Duplicating Dynamically Loaded Image?

Feb 27, 2006

I'm building an image gallery which creates thumbnails by sizing down the original images and once you click on one of them it duplicates itself and displays on top with full scale. I searched the web and everybody say duplicating dynamically loaded image can not be done and only solution is to reload the image. And because they are cached when they were first loaded it shouldn't take much time to get loaded. Also I heard that there is way to force the browser to cathe the image...

View 2 Replies

ActionScript 2.0 :: Duplicating And Positioning Movieclips Loaded From An Xml

Jan 24, 2005

I'm working with a script that loads from an XML some jpgs, these ones once loaded move to their positions.

[Code]....

the problem is that i would like put all these movies well aligned in rows and columns, i've seen it's possible to do this with a nested for.. loop, something like this

[Code]....

View 3 Replies

ActionScript 3.0 :: Flash Loaded Swf Timeline And Duplicating When Adding To Stage?

Sep 7, 2010

I have a couple swfs that are loaded in using Loader, my first problem is I want to stop the timeline until another function when I want it to start. so In the complete function I have

var swfMC:MovieClip = e.target.content as MovieClip ;
swfMC.stop();

but the swf still runs through.Another problem I am having is whenever I add it to the stage it seems to make a duplicate of the swf, and when I remove this duplicate it remains til flash finally crashes. There isnt anything but simple tweens in my swf's (and added trace statements), so they shouldnt be held into memory. that and they shouldn't have been duplicated in the first place... right?

View 1 Replies

ActionScript 2.0 :: Duplicating External Assets?

Dec 16, 2006

I use the Loader class to load external swf. And then I want to duplicate that object.What is the way to go? Is there really no easier way then senocular's duplicateDisplayObject function? Or how about just declaring a new Loader, and reloading the same path from the cache? Its a cheap way of doing it?

View 1 Replies

Actionscript 3 :: Duplicating External Items Into An Array?

Mar 8, 2012

If i was loading external content, such as images or what not will the array load the items twice for example:

load = array(){
load images( "local/folder/www.example.com/" );
items("car.jpeg","bike.jpeg","bike.jpeg");
}

The above is in theory, if you notice twice i have the "bike.jpeg" image in the array; its key value would be either items[1] or items [2].

so with the above idea in mind would this bike image be loaded twice or just referenced in the array from the first initial load.

View 1 Replies

ActionScript 3.0 :: Duplicating MovieClip From External SWF Without Explicit Linkage

Mar 5, 2010

In Flash CS3 I was able to duplicate any MovieClip from an external SWF by loading the SWF, and then executing the following code:
var targetClass:Class = MovieClipToDuplicate.constructor;
var duplicate:MovieClip = new targetClass();

Note that the MovieClips I was duplicating did NOT have any linkage explicitly defined. Flash would automatically assign a unique class to each MovieClip. Now, in Flash CS4, when I try to do the same thing the .constructor property returns only the "MovieClip" class, such that the "duplicate" variable above is but a blank MovieClip. If I compile the external SWF using CS3, my old code still works. But I want to do it in CS4.

View 4 Replies

ActionScript 3.0 :: Flash Loading External Movie Clips And Duplicating Them

Jun 7, 2010

I'm trying to create a user customisable touch screen interface - in which people can include their own button styles (currently created as movie clips). I have a working XML file that names the style / external swf name for each button but I don't seem to be able to then duplicate that movie clip for say use in 10 separate buttons. When I try this only the last one created is displayed. I can of course separately load the file 10 times but that is yuk.

I hope to be able to position the timeline through n states in each loaded clip independently and also have one click handler that can return me an identifier of which was clicked - I know how to loop/create dynamic instance names.

<edit> I can do this successfully from the library - just not as an external file load - where the MC won't be in the library at all.

Code:
//Initialize variable to hold target data
var targetClip:MovieClip;
//********* Add a "MovieClip" variable that will reference the root of the loaded clip:**********

[Code]....

View 8 Replies

ActionScript 3.0 :: Duplicating External Assets / Loader - Why Did Adobe Remove DuplicateMovieClip();

Apr 16, 2007

Yes I know this topic has been discussed before, and I know that Senocular has a class that does it. But the question is...

1) Why did Adobe remove duplicateMovieClip();?

2) Did they intend to have any similar function? Or did they totally forget about external assets?

3) Is there a "Adobe reccomended" code that will do the same thing? (Not that I've got anything against Senocular :bow : but it'll be nice to know if there's a "certified" way of doing it.

View 2 Replies

ActionScript 3.0 :: Duplicating An Image Loaded - Clone Image?

Oct 2, 2009

How should I go about cloning an image loaded form the server and adding it to the end of the first image loaded? Would I use bitmap clone? My attempts with this failed[URL]

Code:
//Creates new image loader
var imageLoader:Loader;

[code].....

View 1 Replies

ActionScript 3.0 :: Duplicating A Loaded Swf - Error "An ActionScript 1.0/2.0 SWF File Has Loaded An ActionScript 3.0 SWF"

Dec 3, 2008

I'm using the suggested method of duplicating a swf that has been loaded by a Loader object. However, the player thinks my swf is AS2 when it definitely is AS3. The Error Message: Quote: Warning: An ActionScript 1.0/2.0 SWF file has loaded an ActionScript 3.0 SWF; code in the ActionScript 3.0 SWF will not run. The duplicate a swf stratgey:

[Code]...

View 9 Replies

ActionScript 3.0 :: External XML Works Loaded Offline Not Loaded Online?

Apr 15, 2009

Code:
var slideNo:Number;
slideNo = 0;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, showXML);

[code]....

View 3 Replies

ActionScript 3.0 :: Unloading A Loaded External SWF With A Close Button On The External SWF To Unload?

Aug 15, 2011

[URL]I have: main.swf (a menu) and I have module.swf (content)If you navigate to Subsea Wellhead Systems/SS-15 BigBore II and click on that I have it load an external swf which covers most of the parent. So far so good. My problem is unloading the loaded 'Child' swf with the button provided on the loaded 'Child' swf.below is the code I used to load the file but I cant, for the life of me, find a way to unload it. 
 
var bigboreLoader:Loader = new Loader();btnbb2.addEventListener(MouseEvent.MOUSE_UP, bigborecontent);
function bigborecontent(event:MouseEvent):void{var bigboreRequest:URLRequest = new URLRequest("moduletemplate.swf"); bigboreLoader.load(bigboreRequest); stage.addChild(bigboreLoader);
 
I am certain it requires the Child to communicate with the parent somehow but I am at a loss. If I could get a bit of advice or a link to something deal with this, it would be a big help. I just need to have my links load my modules and the remove them when the close buttong is hit on the loaded swf. I promise I have done searches and I admit I have found asnwers but still they are not working. I found the code below:
 
Main FLA: 
function removeF() {
removeChild(bigboreLoader);
}

[code]....

View 10 Replies

Flash :: Loading / Unloading External SWF Using Buttons From Loaded External Files

Feb 23, 2011

I spent almost a week trying to figure out how to unload a currently loaded swf using its button and loading a new swf... I have three files, a main.fla, file1.fla and file2.fla. In my main.fla, I have a code which loads the other two files. If i will click the "unload" button in the file1.swf, I would like the main.fla to unload the file1.swf and load the other file, file2.swf. Here is the code to load the file1.swf:

[Code]....

View 1 Replies

ActionScript 1/2 :: Load An External Xml In An External Loaded .swf

Jul 24, 2009

I've got a small (more than 100 hours of thinkwork up till now!) problem I can't seem to solve:

I want to populate an external loaded swf with an dynamicly loaded xml fil (loaded from my config.xml).

[Code].....

how do I get the external xml into the external swf as a variable for the actionscript in the external loaded swf (So I just want to put the path in the script in my external swf...).

View 5 Replies

Actionscript 3 :: Stopping An Externally Loaded Swf From "playing" When Another External Swf Is Loaded?

Nov 8, 2011

I have a homepage with five "links" to each swf. Now the first swf I have a custom cursor that hides the mouse. When I click on that link it plays and when I quickly go to the homepage again it hides the mouse there when it's not supposed to do it.

Same with every other link. When I was busy with the first swf and want to go to the last swf of the five, my mouse just disappears! It is almost as if it keeps on "playing" without seeing the swf...

Here is the code that I have so far!

var currentpage:uint = 0;
//one loader object per project:
var loadingobject1:Loader = new Loader();
loadingobject1.x = 445;

[Code]....

View 1 Replies

ActionScript 3.0 :: Text Is Loaded From External Text Files And Styled With An External Css File?

Jun 7, 2009

I've managed to piece together a flash website with my limited as3 knowledge. The text is loaded from external text files and styled with an external css file.

It's working perfectly in Firefox and Explorer but it only works SOME of the time in Safari (on my mac).It's hit and miss. Sometimes it styles the text sometimes it doesn't.

[Code]...

View 1 Replies

JavaScript :: How To Know If External SWF Loaded

Mar 20, 2012

I have javascript that loads external swf, appending tags "object" and "embed" when page has been loaded. I need to handle event when swf is completely load.

View 1 Replies

Actionscript 3.0 :: Loaded External SWF?

Jun 11, 2009

Can an external SWF, loaded using the Loader class, pass info to the host SWF?I am loading an external video player into an interface(host) and would like for the video player to tell the host that the video is done playing so that it can move on to the next one.

View 5 Replies

ActionScript 2.0 :: Being Loaded As An External Swf?

Mar 8, 2006

I'm having issues with my flash based contact form that uses PHP. My site is set up with a main movie and each page is loaded into that main movie as external swf's. The contact form loads in fine, it allows me to type my name, email, and message and then send. It even responds saying that the function worked and takes me to my success frame label. The email sends but when I open it up in my inbox none of the information is there. My labels are there from the PHP file but none of the information I entered into the form shows up. However, when I reset the paths in the actionscript and just view the swf online directly (not loading it into the parent movie) it works just like above but I can see the information I entered into the contact form, in the email. it works perfectly. so somewhere my actionscript is wrong when it's being loaded as an external swf.

[code]...

View 1 Replies

ActionScript 2.0 :: External SWF Not Being Loaded Where It Should Be

Jun 14, 2006

I am trying to load an external swf-movie into my main swf, thou the swf loaded isn't being placed where I want it. So I created a main swf and in that swf I made a new layer and made a rectangle called holder, which holds the different movies being loaded. And then I created a layer made a smaller rectangle called loader which is suppose to load the external swf, but the loaded movie isn't being loaded into the loader-rectangle, it's being placed somewhere else in the main swf, I don't understand why.

However, here comes the code:
var mcl:MovieClipLoader = new MovieClipLoader();
var mclL:Object = new Object();
mclL.onLoadProgress = function(target,loaded,total) {
loader.percent.text = Math.round((loaded/total) * 100) + "%";
} mclL.onLoadInit = function() {
loader._visible = true;
loader.percent.text = "";
} mcl.addListener(mclL);
mcl.loadClip("news.swf",loader);

View 5 Replies

ActionScript 3.0 :: Accessing Loaded External Swf?

Mar 30, 2009

I am using a zoom component which i purchased recently to load different external swfs on different button clicks. But instead of loading separate external swfs I would like to load a single swf and go to frame labels - "one", "two", etc. - I've been reading about casting the external swf as a movie clip, but I am confused how this would work with the code I have at the moment.

var image:String="introlocal.swf";
function loadContent () {
var myLoader:Loader = new Loader();

[code].....

View 1 Replies

ActionScript 2.0 :: F8 Unloading An External Swf Once Loaded

Mar 31, 2009

I have a main movie menu which has sub movies loaded into levels 1 then section 2 into level 2. I have the subs loading on button but i cant get the subs to unload levels 1 and 2 once they have played.

View 7 Replies

Preloader Will Not Show / When External Swf Is Loaded

Jun 1, 2009

I have my main movie, and from there an external movie is loaded which has a scrollpane on it. Problem is the preloader will not show when the external swf is loaded...when the button is clicked, nothing happens for about 3 seconds and then eventually the scrollpane comes up. I have the preloader on Scene 2, and it works for all my other external swfs so I know its the scrollpane issue.[code]I have tried have the "export to first" frame linkage thing but that doesnt work... does anyone know how best to do this?

View 2 Replies

Doesn't Work When Loaded Into External Swf?

Aug 30, 2011

I've only been working with flash for about 3 weeks and I'm fairly new to programming soI'm using Flash CS5 with AS3 btw.

Code:
///////////////////////////
// Custom Mouse Controls

[code]....

View 2 Replies

Professional :: Check An External Swf Is Loaded?

May 31, 2010

I'm loading an external .swf via typing the swf name into an input text field and hitting a submit button.

The swf loads fine, but I'm trying to incorporate updating a status text field on a successful load or if there is an error during loading.

I can't find my mistake in the code - to me it should be making load_status_txt display "ok", but the swf just loads with no status update. All the text fileds are fine, because if I code load_status_txt.text = "hello" straight after addChild(loader); - load_status_txt displays "hello"[code]...

View 3 Replies

ActionScript 3.0 :: Communication With External Swf Loaded Into Mc?

Sep 6, 2011

wf which loads an swf into a movieclip called content_mc here is the code located in the blank swf
 
startLoad ("startPage")
var loadedSWF:Loader
var content_mc:MovieClip=new MovieClip();
function startLoad (SWFname:String){
loadedSWF = new Loader ();

[Code]...

View 12 Replies

ActionScript 3.0 :: External File Is Loaded Or Not?

Sep 27, 2011

I have one text file which i am loading externally from my local machine. I am trying to read some variables from this file.
 
my problem: if the text file somehow fails to load in flash then it should load variables from HTML file from which my swf is running. But i am not able to check if this text file is loaded or not.
 
my code: (working if text file is present)
 
///Local Variables Loading//////
var myLoader:URLLoader = new URLLoader();
myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

[Code].....

View 2 Replies

ActionScript 3.0 :: External Swf Classes Loaded?

Mar 5, 2012

I have external swf (ext.swf) that is loaded in my FlashDevelop as3 project.When I make check (objectsList[0] is Class1) I am getting false even though the objectsList[0] element is Class1. The Class1 is in the ext.swfBut when I write command like (objectListInExternalSwf[0] is Class1) in external swf and then use that swf in my project and make check (objectsList[0] is Class1)My question is: do I have to use all the classes in my external swf so the compile

View 1 Replies







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