ActionScript 2.0 :: Executing External Functions From A .swf Loader?
Sep 29, 2009
how i should be executing external functions from a .swf loader...here's my loader function:
Code:
on (keyPress "e") {
_root.createEmptyMovieClip("container", 1);[code].......
i can easily load the swf into the frame, but the colors don't change. Playing coloreffects.swf on its own works fine, just not through the loader. I imagine this is because you can't just operate two levels of AS2 at once...
View 7 Replies
Similar Posts:
Mar 19, 2006
I've done some searching around and was wondering if this works. Is it possible to send a function command to a SWF from an HTML page? Basically, a javascript based menu that executes a function in a swf contained on that page.
View 2 Replies
Jan 31, 2007
I'm making a little movie where, when a button is clicked, a swf file is loaded into a movie clip using the MovieClipLoader object, and on the onLoadInit event, the clip's alpha and _x are both eased using custom prototype methods. When I first test the movie, it works fine - it fades/moves in correctly. If I click the button while it's still easing, it again reloads and looks fine - but for some reason, once I wait for it to fully ease in, when I click the button, it first loads, then the Alpha eases up to 100, and THEN it eases to the _x. [code]...
View 2 Replies
Jun 1, 2010
my problem: I have a SWF which contains classes that I really need to use(I know their definition names). I tried decompiling it with Sothink's Decompiler, but the code got out with errors. So...an idea came up to me yesterday - to use the classes at runtime, by "importing" the SWF with the Loader class... The problem is....so this is the problem - the Loader.load or loadBytes methods also "PLAY" the loaded swfs, or these methods EXECUTE the loaded SWF's code - I don't want that, I just want to be able to use the classes inside the SWF. What if the SWF also plays when loaded?
Not that big deal, you may say, but here comes the real problem, which gave me real headackes - when I load the SWF the error "Cannot access a property or method of a null object reference." comes up, which makes me think that the external SWF is executing and has some execution error, if i might call them like this. In other words, it tries to access a null object...you might see now why i am trying to avoid "executing" or playing the SWF when I'm loading it - cause it's pretty hard to find out which part of the loaded swf's code caused the error, which in turn forbids me to use the classes inside the SWF with the getDefinitionByName method.The SWF that I'm trying to load was designed for web-page execution, and got flashVars from the webpage, I'm thinking that;s why that error appears - because the SWF plays only on a webpage domain.
View 9 Replies
Mar 26, 2010
I have the following code which simply loads an external swf, puts it in the right place and should all be hunky dory.This works:
Code:
var myLoader:Loader = new Loader();
addChild(myLoader);
var url:URLRequest=new URLRequest("foobar.swf");[code].....
to set the dimensions of the loader so the external swf doesn't 'spill over', the result is a blank screen. No matter how high I set those dimensions it just doesn't display anything.
View 4 Replies
Jul 29, 2009
One of the swf files in my project is acting strangely.The file compiles perfectly, and is functional when running stand-alone.If I try to load it into the main swf in my project, the code stops executing just prior to the first for..
loop.To find out where the code was stopping, I placed a textfield on the stage named "stageText", and assigned different strings to it at various points in the flow of actionscript.It stops executing immediately after stageText.text = "init2";, and just before the first for..loop. (see comments in code)Why is the code stopping at the for loop?Why does it only happen when the file is loaded into another swf?
Code:
import gs.*;
import gs.easing.*;
var locationsXML:XML;
[code]....
View 1 Replies
Jul 29, 2009
I have a main "shell" swf which, by clicking several buttons, will load/unload various external swfs into a Placeholder_mc which resides on the main timeline in Shell.swf In the documentation and tutorials I've seen a couple different methods, and I'm not sure I quite understand the difference, or at least the reason you would use one over the other...In the 1st method, you can just add the Loader object using the addChild() method:
Code:
var myLoader:Loader = new Loader();
var myURLRequest:URLRequest = new URLRequest("ExternalFileA.swf");
myLoader.load(myURLRequest);
Placeholder_mc.addChild(myLoader);
This will apparently add myLoader to the display list once it has completely loaded.The 2nd method, you supposedly can add the Loader.content; however, it appears you can only do this once the content has completed loading, so you need to incorporate an event handler with the contentLoaderInfo object:
Code:
var myLoader:Loader = new Loader();
var myURLRequest:URLRequest = new URLRequest("ExternalFileA.swf");
myLoader.load(myURLRequest);
[code]....
What are the pros/cons of adding the entire Loader object, as opposed to the Loader.content and vice versa?
View 7 Replies
Nov 17, 2010
as3 is new for me, but i would like to write a script using loader to load an external swf, and control the external swf. But I find I can't control the swf, because there are no fixed instance name. here is my script.
[Code]...
View 3 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
Aug 3, 2011
Im going to develop an FLASH App to use an external SWF file as a reference to call its methods & functions.
View 0 Replies
Aug 19, 2007
its a site about interior design. my job is to add some code to do something. i checked the code and his approach is not so good.. he's coding inside objects and frames at the same time. (ive read many actionscript books and this is a really bad practice). Here's the problem... he wants this to be implemented in the site...1.) in the gallery there is a scrolling thumbnails, he wants this to pause about 4 seconds then it will start to scroll..(ive already fixed this by creating a function interval.
Here is where my problem is...2.) When you click the thumbnail, the enlarged view will pop up.. the enalarged view are external swfs... the client wants that when you click on the thumbnail, the scrolling will stop and the external popup enlarged image will come out...this external swf has an exit button to go back to the main gallery window which is another swf... so the client wants that when you hit exit from the external swf popup window, the scrolling will resume.... im having a hard time figuring this out because i dont know how to call a function from an external swf to the main movie (the gallery page) Ill post the fla of main movie, gallery and a single external swf link of the thumbnail. just click on the first picture that will appear on the gallery
View 1 Replies
Jan 27, 2009
I have a loader component on my stage that I load 30 or so different external swfs into. Their stages are all exactly the same size as the loader. But one external swf has an image that extents outside it's stage size, AND it is this that gets rescaled (shrinks) when loaded into the loader. How can I fix the size of just this one external swf?
[Code]...
View 2 Replies
Apr 5, 2011
I have a map of the US acquired from here (called U.S. Map). I am currently generating XML from inside an ActionScript file, and would then like to display this map using my generated XML as the argument. According to this, to do this in html would require the following declaration:world.swf?ata_file=pathname/filename.xmlHow can I replicate this behavior using the Loader from ActionScript? Right now I have:
var ldr:Loader = new Loader();
var url:String = "us/us.swf?data_file=senate.xml";
var urlReq:URLRequest = new URLRequest(url);
[code].....
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
Nov 1, 2011
I am trying to load an external swf into another swf using Loader but I am having difficulties to do so. The thing seems to be that some of the classes of the loaded clip are called the same as the parent clip's classes. Both swf's document classes are called "Launcher", for example, also they use StringUtil (tho both projects have their own "StringUtil" class).
View 4 Replies
Aug 23, 2010
I am using the below code to load in external swfs. I normally put the preloader in the external swf but that does not work with this code. I therefore need to put the preloader in this swf. All the preloader need to be is the numbers (1-100).
Code: Select all/
/EXTERNAL SWF LOADER
var loader:Loader= new Loader();
[code].....
View 3 Replies
Mar 25, 2010
I have a Main.fla which loads Main.as as its document class. In Main.as I have a public function named "Main" which runs a trace. I also have another .as file called Preloader.as, which also has a public function in it, this one named "Preloader" with simple trace in it. I just cannot figure out how to use Preloader() from the Preloader class in Main() from the Main class. Main.as loads up fine when the SWF loads and traces.
View 10 Replies
Jul 30, 2009
how to access functions on my main SWF file from a loaded SWF file?
View 13 Replies
Mar 14, 2011
I was told recently by a Flash developer that I respect that using
include "functions_file.as";
is not the appropriate way to import a list of functions into an AS3, Flash CS5 document.We're not talking about objects and packages, just a list of functions.
View 2 Replies
Jun 23, 2009
I have a doubt about access functions between an MAIN fla and his external Movie.
All I need is to return a variable to the MAIN.fla function as TRUE.[code]...
View 0 Replies
Feb 9, 2010
I've got this external class that I'm loading into a function, it traces. But then I try to use the already loaded class in another function it tells me that I'm trying to access something that's not defined[code]...
View 0 Replies
Dec 29, 2010
I have a main actionscript file import other actionscript files into it to use their function. From the tutorials and training videos I have, other external classes apart from the document class always link to an object in the library or an object in the main.as is an instance of the other class, for example:[code]
The problem is I'm not creating any variables from the external class but only want to use the functions from it. When I test the movie, I get error 1180: Call to a possibly undefined method isPossibleNo, which is inside class ProjectileNo that is imported already.So my question is how I can use external functions without creating a new instance of the external class because they only hold calculation functions.
View 2 Replies
Aug 26, 2009
All I need is to acess the External Movies functions, variables and the External MAIN TIMELINE to control the loaded content.
How do I do that?
I've traced the content just to give a better idea about my Structure[code]...
View 4 Replies
Apr 13, 2007
I'm a graphic designer trying to muddle through enough AS to create a bilingual site.I start it off by setting a variable, "currentlang" upon clicking either the "english" or "french" button. Like so:
on (release) {
_global.currentlang = 1; //english
_parent.gotoAndStop(3); //action begins on the 3rd frame of main movie
[code]....
This works fine for the clips on the main movie, but what happens when I load in external SWF's. How could I make my function "toggleLanguage" talk to newly loaded clips? On the external clip I'm loading in, I have the following code on the timeline:
if (_global.currentlang == 1) {
this.header.gotoAndPlay(1);
} else if (_global.currentlang == 0) {
this.header.gotoAndPlay(2);
}
This works fine when the new movie loads in, meaning that if my "_global.currentlang" on the container movie is set to French, the loaded SWF will display "Bienvenue" rather than "welcome", and vice versa. The problem arises when I try to toggle the language. It only toggles the language of the clips on the main timeline and not the newly loaded ones.
View 2 Replies
Jun 25, 2007
i am loading in a movie clip from a location online. that much works fine, however, in this external movieclip, it is making a _global function call to some code i have in my main swf which this clip is being loaded into.
[Code]...
View 2 Replies
Oct 18, 2010
I'm a noob to this whole class thing, so how would i say in an external as file
Code:
function blah(){
//blah
[code].....
View 9 Replies
Apr 25, 2009
I have a flash rotating banner script that I purchased, and wish to incorporate into my homepage. Instead of creating a page with HTML and adding the banner code as a separate object on the page, I wish to load it as an external swf into a movieclip on my stage. This is what the banner looks like:
[URL]
I have a page that I'm redesigning, it's located at:
[URL]
I have a movieclip named load_banner. Inside the movieclip in its own frame, I put in the following code:
Code:
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
[Code]....
However when I test it, the images load off to the right hand side of the screen, not centered in the movie clip like I want...
View 11 Replies
Jul 13, 2010
I am trying to make this website, which has separate files for different screen resolutions. I am using a first.swf file to load the right file, depending on the screen resolution, it goes to a different frame for diff resolutions. There I have placed a loadMovie function.The code for the loader follows the loadMovie call. loadingbar is a movieclip on screen, which presently does nothing.[code]This was displaying nothing, so I replaced the _root.loadMovie with mcholder.loadMovie("filename.swf"). This is not working either, the screen flashes for one second and then disappears. I put a stop(); before the code, and the screen remained, but the movie still did not load.I txt1.text shows 100. meaning percentage did reach hundred, but I am guessing that is for first.swf, and not for the file which is being loaded.
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
Jun 2, 2010
I am using the Loader to load an external swf into my program. Inside the external swf, I need to be able to access the Loader instance that just loaded it. Does the loader add the external swf to itself before any code inside the swf gets executed? When is it safe to access the loader via the following code?
var target:DisplayObject = this;
while(!(target is Loader) && DisplayObject(target).parent != null){
target = DisplayObject(target).parent;
}
View 2 Replies