Actionscript 3.0 :: Referencing The Timeline Of An External/library Loaded Swf?
Oct 25, 2010
So I am using the following code to load an external swf and am trying to reference the timeline of the loaded movie i.e. a frame label. Say I wanted to do a simple gotoAndPlay what is the syntax? I would use (myloader.gotoAndPlay ("framelabel") this seems like an obvious answer but doesn't seem to work for me.
Code: Select allfunction yesClick(event:MouseEvent){
/////// Loader (Loads External SWF lesson file) **********************************
var myLoader1:Loader = new Loader();
I just poked around google as well as these forums, but the only answer I am seeing that was successful, is from kglad, and for some reason his posts are not showingAnyway, I am just trying to figure how to reference a frame label on my main timeline from a loaded swf (through my imageLoader).
Im working on a App that is using a external swf as a container for some graphical assets. An asset is a movieClip symbol with a class name attached to it. for example ASSET_1. I load the swf with the Loader class into the app. Its working fine I can also access ASSET_1 with this technic:
//--- inside onLoaded var ASSET_1:Class = event.target.applicationDomain.getDefinition("ASSE T_1") as Class; var asset:MovieClip = new ASSET_1() as MovieClip; addChild(asset);
my problem start when im loading a second swf and than i try to access "ASSET_1" again, and the class doesn't update itself, the content is the same as in the firs one.
As one would expect, Classes within my RSL can access the classes and methods of the embedded swcs. In other words, classes in my library can for instance call import org.alivepdf.Print and then call AlivePDF's Print.print() method. But it there any way for my project to also use those third-party classes and methods, by "tunnelling through" my RSL??? Even though my project is using my RSL, when I try to type out org.alivepdf.Print it cannot be found.(Obviously I can make a manager class in the library to "pass through" specific commands to the embedded swcs; I'm looking for something a little more generic and all-encompassing here).
I have a swf that gets XML of a location of another swf and loads it. It then casts the loader's content as a movie clip and adds it to the stage. I have that working fine, but how can I control the timeline of the loaded swf?
I'm having issues with an animation and need to get it functioning properly. I've posted two example/demo files to illustrate desired functionality.The main timeline (testMain.swf) consists of a loader, section/slide one content, and a button (bttnClick) set to load an external swf (external.swf).
external.swf contains two additional sections/slides and two 'next' buttons (bttnEnter with 'bNextOne' & 'bNextTwo' instance names) to navigate. When the second 'next' button (bNextTwo) is clicked I need the loaded external swf to fade out revealing the original main timeline (testMain.swf) and returning/stopping playhead at the 'slideOne' frame label. Does the external swf need to be unloaded even though users will most likely go back to it? What�s the best way to handle this?
If you could assist with the external swf fadeout to main timeline, the return to 'slideOne' frame label, and insight as far as the best way to return to the external swf.
I'm trying to check for an external swf file being loaded using event.target.name=="pubResCHETNA" and currentFrame == second frame of scrollPaneGroup movieclip (the scrollPaneGroup movieclip is from a external loaded swf file)
Here is my code: var currentSWF:MovieClip= new MovieClip(); currentSWF = MovieClip(loader.content); if(event.target.name=="pubResCHETNA" && ?????? ) How should I place the condition over here? { fCbtn.buttonMode=true; fCbtn is a movieclip reside in second frame of scrollPaneGroup movieclip of "pubResCHETNA.swf". }
I'm about 10 hours deep into getting an external swf to be loaded on a page in my main timeline. I've gotten as far as loading the external swf (within the first few hours) hahah but now, have spent twice as long trying to get the external swf to be removed when a person navigates to a different page of my main timeline.
I have a videoplayer on one frame which is my "video" page. I've gotten the external swf to load two different ways, for example, the latest code i am using to load the external is below and seems so nice, clean and simple:
var request:URLRequest = new URLRequest("VideoPlaylist_HV.swf"); var loader:Loader = new Loader() loader.load(request); addChild(loader); loader.x = 180 loader.y = 50
But I would like to add a function that says on any mouse click event (navigation) close the swf that is loaded.
If any of you genius people out there can help me, please do. I thought getting it to load was going to be the hard part but I was wrong. I am very discouraged by Actionscript in general.
download what i have so far, i left alot of the content out so the file size isn't big. And yes, i am sure once you see how I work you will be sure that I am no flash expert. I can send a link to the .flas, the site won't allow me to post the link as I am new.
I need to determine when the first swf has finished to load the second and so goes on but I couldnt find a way to even trace de current frame in the timeline of my external swf.How can i determine the current frame in the timeline of a external swf?even with a enter frame event to check the current frame has not workedIve even build up a class to give the parameters to the main SWF but has not worked.I need to compare the current frame with the total frame and when got the last frame, and the end of the animation, unload this first movie and load the second.
how to sequentially play external SWFs loaded into the main timeline?
I have several SWF files with short videos embedded in them. I wish to load these external SWF files into my main timeline as follows:
User Presses Button -> Play Video Clip in External SWF#1 -> Once Video Clip in External SWF#1 has Finished -> Play Video Clip in External SWF#2.
I tried achieving this by adding: var endmovie:Boolean = true; to the end of each video clip inside the external SWFs (e.g. 1.swf) then cycling through an if statement in the main timeline to see when this condition was meet:
ActionScript In Main Timeline:
Code: var mc_Loader = new MovieClipLoader(); mc_Loader.addListener(this);
[Code].....
How is the best way to go about achieving this? Am I on the right track? (By the way, using .FLV or one long external SWF file is not really an option due to long loading times...
I don't know how to reference to sharedLibrary.swf file.That sharedLibrary.swf is in root folder and another swf which uses sharedLibrary.swf is in folder TEST.I try to pur reference like: ../sharedLibrary.swf and ..sharedLibrary.swf and ..\sharedLibrary.swf and ..//sharedLibrary.swf
I'd like to add a couple of different MC's to the particle stream. I'd like to do that by referencing different items in the library.So I have 12 different particles in the library exported with classes named from Bubble0 to Bubble10 now as I run through my for loop I'd like it to use a different particle each time. first time I tried:
ActionScript Code: var bubbleArray:Array = new Array(); bubbleArray.push(Bubble0,Bubble1,Bubble2,Bubble3,Bubble4,Bubble5,Bubble6,Bubble7,Bubble8,Bubble9,Bubble10,Bubble11) for (var j:uint = 0; j < NUMBER_OF_BUBBLES; j++) {
[code]...
Scene 1, Layer 'actions', Frame 1, Line 871086: Syntax error: expecting semicolon before leftbracket.Is what I'm trying to do possible without some clunky switch statement?
P.S. I tried searching the forum for an answer but the terms are so common I couldn't find what I'm looking for.
I make a movie clip in the library ( a button with a text field on it ) and export it for actionscript. Then I create an instance of the object using code ( myButton = new Button1(); ).And then I want to access and change the text field ( whose instance name is "myField" in Flash ) afterwards.Is that possible, or I have to create a custom class for the object, or just create an entire button dynamically?
Because what I have tried until now doesn't work.
Code: var button1:button_test1 = new button_test1(); button1.x = stage.width / 2; button1.y = stage.width / 2;
[code]....
This questions is for all movie clips: is there a way to access a movie clip's objects with actionscript after you have created (with code) an instance of that object (which was designed in flash, and exported for AS) ?
I can import other classes to the timeline and use them just fine, but this class is giving me major problems? I am parsing XML data from my server on it and it is giving me errors that look like this.
The timeline reference and usage: import networkScores; var network:networkScores = new networkScores(); addChild(network); score1Textfield.text = network.score1.toString(); [Code] .....
The errors I am getting: Scene 1, Layer 'Actions', Frame 4, Line 149 1119: Access of possibly undefined property score1 through a reference with static type networkScores. 1067: Implicit coercion of a value of type networkScores to an unrelated type flash.display:DisplayObject.
I have a root timeline in which contains a movie clip on a certain frame. Inside that movieclip, on it's second frame, there is a button. I would like to use this button, when clicked, to move take the user to a frame on the root timeline.
i just wanted to know if its possible to reference a different levels timeline. I want to create transitions in my site when loading dynamic content. I looked at the tutorial but it specifiacally relates to loading movies into movie clips. In my site i am already loading movies into levels.
I have my navigation on the main timeline (level 0) and im loading and unloading each sections content into level 1. Is it possible to load a movie on level 2 with a mask and preloader that will cover the content being loaded into level 1?
This used to work in flash 8.I just purchased CS4 and am trying to learn a few basics.I have nested arrays on frame 2 of the main timeline. [code]I can no longer use _root. on the mc to reference the main timeline.If I trace myQuestions from the mc I get an error.
I have a 13 movieclips within another movieclip which in turn is placed on the root timeline. I have written a function in the actions layer of the main timeline: function illboxClear(){ _root.illpre.ill1.gotoAndStop(1); _root.illpre.ill2.gotoAndStop(1); _root.illpre.ill3.gotoAndStop(1); _root.illpre.ill4.gotoAndStop(1); [Code] .....
It sends the animation in each of those described movieclips back to frame one as you can see. When I try to call the function from actions on a button which itself within a separate movieclip placed on the stage: on (rollOver) { illboxClear(); _root.illpre.ill2.play() } on (rollOut) { _root.illpre.ill2.play() } on (release) {getURL("boxer.html","_blank"); } It doesn't work! Can I not call functions from button objects or have I made some other elementary error?
I'm trying to:Jump from frame 1 to a frame later in the main timeline Reference an object that exists on the stage in that frame, but not in frame 1
Like so:
ActionScript Code: function endGame():void { gotoAndPlay("gameOver"); scoreField.visible = false; }
A movieclip with the instance name 'scorefield' exists in the "gameOver" frame, yet for some reason, I just get a "Cannot access a property or method of a null object reference." This code is all within a function. By the time the reference to scoreField is executed, the timeline is at the right frame.
I have a main fla file which loads an external swf into an empty movieclip on the main timeline which works fine but I want a button in the external swf to load another external swf into another empty movie clip on the main timeline.eg. start.swf loads UKEIAMap.swf into (empty movie clip within start.swf) MapLoader_mc then a button havant_b within UKEIAMap.swf needs to load HavantProjectSheet.swf into (empty movie clip within start.swf) ProjectSheetLoader_mc without unloading UKEIAMap.swf
I'm loading an external SWF("slides.swf") into a AS3 UILoader component on the main stage with an instance name of "loadWindow" when the user clicks a button.I'm also monitoring "slides.swf" loading with preloader script. When the movie in the UILoader is completely loaded, I want to advance it (the movie within the UILoader) to the next frame. In AS2 it was easy to reference a swf loaded into a movie clip... the nested movie's root took the place of the MC's timeline.
stop(); load_btn.addEventListener(MouseEvent.CLICK, loadFile); function loadFile(e:Event):void {
I have a swf that is loaded into my main swf with the loader class. When I click a button in the main swf I want to call a function in the loaded swf Main class.
When I do a trace it is showing the loaded clip as [object Home] which is the name of the Main document class associated to the loaded swf. I have a public function in my Home.as called startAnimation() but when I try to call it I get
[quote]1061: 1061: Call to a possibly undefined method startAnimation through a reference with static type flash.display:Sprite.
The following code gives me an error:1119: Access of possibly undefined property sp1 through a reference with static type flash.display:Sprite.Not sure how to get around this issue... these things used to work in as2, I guess not anymore in as3...
---------------------------------------------------------------------- ------------------------------------------------------- loader = new BulkLoader("timelineLoader");loader.add(ExternalFiles.TIMELINE_SWF);loader.addEventListener(BulkLoader.COMPLETE, onCompleteHandler);loader.start();
But when I do this, since the movie is not loaded the file is not compiled and gives me an error your referring to something that is not there. How else am I supposed to reference a content that will be loaded later?
The starting point is that I load an external PNG file into an open SWF application with the following code:
--------------------------------------- var loadListener:Object = new Object(); loadListener.onLoadInit = function():Void { //do certain actions - not relevant for my question };
[code]....
That works fine. The problem is how can I later reference to 'flower02.png' as BitmapData which is loaded as a movieClip into the movieClip 'mc1' to execute certain BitmapData methods like in particular 'copyPixels()'?I'm aware that I could use:
--------------------------------------- import flash.display.BitmapData; var libId:String = "flower"; var flowerBmp:BitmapData = BitmapData.loadBitmap(libId); ---------------------------------------
In this way I could reference my BitmapData by its variable identifier 'flowerBmp'. But this would require that my 'flower02.png' is already in the library which is not possible for my purpose.
I'm having trouble referencing variables in a loaded movie. I read in other posts that you simply refer to the variable as if it belongs to the clip you load it into, however this doesn't seem to be working for me
then MySWF doesn't show up on stage whereas with aSlider.addEventListener(SliderEvent.CHANGE,OnSliderChange); it does appear. I need to use this["aSlider"] because of this [URL] as pointed by [URL] to my previous question.