ActionScript 3.0 :: Calling Function From Externally Loaded SWF Into Main SWF?

Apr 4, 2009

I've written a script that takes keyboard input to turn movieclips on and off in a swf file (like the visible/invisible layer function in photoshop). Then I'm attempting to load the *.swf (image.swf) into a zoom/pan flash file from flash den. When I load it in, the keyboard controls no longer work. I've tried importing the keyboard control function (keyDownListener) into the main zoom.fla with this script:

Code:
import flash.display.Loader;
import flash.net.URLRequest;

[code].....

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Loaded SWF Calling Main Timeline Function

Aug 5, 2009

I have a project which requires the loading and unloading of multiple "scenes". All my navigation is working (probably not the most efficient way) but I'm having one issue. I need a button on one of the loaded SWFs to call a function on the main timeline. Since Actionscript 3 no longer supports the _root functionality the way AS2 did, I cannot access the main timeline.

In general, how do I get to the root of the main timeline without using _root?

Also, how can I reference the loaded SWF and objects inside of it from the main timeline?

View 1 Replies

ActionScript 2.0 :: [Flash8] Calling Functions From An Externally Loaded .swf?

Sep 20, 2009

basically, each time i hit a letter key on my keyboard, i want a new .swf to load. All of the external .swfs are looped, which is working fine, but for me to get this one to do what it should, i need to press another key to get it to advance to the next frame and play. Since i'm operating it from a loader, i can't get the function to call.

so here's my loader function:

Code:
on (keyPress "e") {
_root.createEmptyMovieClip("container", 1);
// Container's positions on stage

[code]....

View 1 Replies

Access Main Swf X,Y From Externally Loaded It?

Jan 7, 2010

I have a site that I'm working on that I am loading an external swf page into a main one. The main one is based on a totally liquid state and stretches the background to fill the browser and the components are relatively position based on browser window dimensions.

Now inside of the main swf I load an external swf through the loader command. This swf has a set dimension and stays centered in the stage.

I am trying to make a button in this swf that loads yet another swf that is stretches the full browser. However I do not know how to access the properties of a main swf from this external one, or if this is even possible.

View 3 Replies

ActionScript 3.0 :: Communication Between Main And Externally Loaded SWF

Aug 30, 2010

I basically need to communicate to an externally loaded swf and send info back to main swf. Below is some sample code of what I am trying to achieve:

In the main swf:
var imgLoader:Loader = new Loader();
imgLoader.load(new URLRequest("external.swf"));
addChild(imgLoader);
var MC:MovieClip = imgLoader.content as MovieClip;
//var MC = MovieClip(imgLoader.content);
trace(MC)
MC.btn1.visible=false;

In the external swf:
btn1.addEventListener(MouseEvent.CLICK,externalCli ck1);
btn2.addEventListener(MouseEvent.CLICK,externalCli ck2);
function externalClick1(e:MouseEvent):void {
trace("external Click 1");
//main swf goto nextFrame;
} function externalClick2(e:MouseEvent):void {
trace("external Click 2");
// main swf goto PrevFrame;
}

The trace I have setup in the main swf, trace(MC) returns a null value.

View 2 Replies

ActionScript 3.0 :: Turning On/off Timer In Externally Loaded SWF From Main SWF

Mar 28, 2010

I want to know if its possible and if so how, to stop the timer in an externally loaded swf from the main swf that's its loaded into.

Just to give a quick basic rundown of the set-up. There is the main swf which via a class called Img loads smaller swfs:

PHP Code:

package {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.display.Bitmap;

[Code].....

The _scr bit is a string which gets passed in that comes from an XML file with the source of the external SWF to load. In the SWF there are some actions that are dependent on a timer. From the main SWF I want to be able to turn the timer on or off.

Do I need to put a addEventListener in the external SWF file?

View 3 Replies

Get An Externally Loaded Movie Clip To Inherit The Playhead Position Of The Main Timeline?

Oct 17, 2009

I have been approached to design a configurator for a new television product. The Application will let users specify the colours of certain parts of the product and also attach addons, which then updates a cost total.

In the main interface i have a looping animation of the product slowly rotating around 360 degrees that i rendered in 3ds max. When a user clicks a button on the interface i need to load an external movieclip on top of the main animation so it looks as though a certain part has changed colour, this i have acheived. The problem is that when i load the external clip over the original, the loaded clip starts playing from frame 1 and i need it to inherit the playhead position of the main animation so the two layered pieces look as though they are rotating as one. I'm sure this must be possible, unless i need to approach the problem in a different way?

View 7 Replies

ActionScript 2.0 :: Recognizing Within Main Timeline A Button Located Inside Externally Loaded .swf?

May 13, 2005

I'm using the preloader like the one rhamej posted here:[URL]The part of the code I need help with is as follows:

[AS]
//fire the MovieClipLoader and attach the listener to it
var container1:MovieClipLoader = new MovieClipLoader();
container1.addListener(mclListener);

[code]....

I realize the code is wrong. I wondered if it was possible after loading an external .swf ("1_movie.swf") within the container, if you could then press a button (enter_button) located within the external .swf ("1_movie.swf") , and use the preloader code to load another external .swf on release ("tree20.swf"). I'm having trouble because the preloader code is in the main timeline of my main flash file ("index.fla"), and I don't know how to make the preloader code recognize the button located within the external .swf, and use it to load another external .swf within the same movie clip.

View 3 Replies

ActionScript 2.0 :: Recognizing Within Main Timeline A Button Located Inside Externally Loaded .swf

May 13, 2005

I'm using the preloader like the one rhamej posted here:

[URL]

The part of the code I need help with is as follows:

[AS]
//fire the MovieClipLoader and attach the listener to it
var container1:MovieClipLoader = new MovieClipLoader();
container1.addListener(mclListener);

[Code].....

I realize the code is wrong. I wondered if it was possible after loading an external .swf ("1_movie.swf") within the container, if you could then press a button (enter_button) located within the external .swf ("1_movie.swf") , and use the preloader code to load another external .swf on release ("tree20.swf"). I'm having trouble because the preloader code is in the main timeline of my main flash file ("index.fla"), and I don't know how to make the preloader code recognize the button located within the external .swf, and use it to load another external .swf within the same movie clip.

View 3 Replies

ActionScript 3.0 :: Calling Function From Main.as?

Sep 1, 2008

I have a buttons class I would like to access but not sure of proceedure. Here is the Main.as

and here is the button class

this is actions layer:

View 1 Replies

ActionScript 2.0 :: Call A Function In An Externally Loaded SWF?

Jan 7, 2005

is it possible to call a function in an externally loaded swf from _level0 ?I have "mySwf" with "myFunction" in it. I have "myMovie" which loads "mySwf" can I call this.mySwf.myFunction(); It dosn't seem to work for me...

View 3 Replies

ActionScript 2.0 :: Call A Function In An Externally Loaded SWF

Jan 7, 2005

is it possible to call a function in an externally loaded swf from _level0? [code]It dosn't seem to work for me..

View 3 Replies

ActionScript 2.0 :: Calling Function From Main Timeline

Oct 13, 2008

I decided to rewrite my question from an earlier post...I'm using the TextMetric class: URL...The code below currently resides on the attachedMC timeline, and is written twice with different variables for each time called for each dynamicText.[code]What i am trying to do (emphasis on trying) is write the code on the main timeline, so that it can be called from any attached MC, a sort of global function if you will. Another thing to note is that there are multiple dynamic Texts using the function at the same time.[code]

View 4 Replies

ActionScript 3.0 :: Calling Main.function Does Not Work

Mar 15, 2009

I can't seem to access functions (methods) of my document class from any other class in the same package. What i need to do is create some global functions like menu reset, title change, etc. Maybe i'm not fully understanding the OOP concept, because this seems simple and it should totally work, but it doesn't and no documentation has been able to tell me why.

I have a document class called Main.as like this:

Code:
package
{
import flash.display.Sprite;

[Code]...

View 5 Replies

ActionScript 3.0 :: Unload Externally Loaded Swf From Mc With Load Function?

May 20, 2010

I'm not new to flash as2 but as3 is a whole other animal to me. What I have is on button click my script will load a swf movie into a movie clip (videoLoader_mc). What I'm trying to do but can't seem to get is when the parent swf gets to a certain point in the time line I need it to unload what ever movie is in that videoLoader_mc. I've gone through ever tutorial I can find to no avail. [code]...

View 0 Replies

Actionscript 3 :: Error When Calling A Function From Main In Flex?

Oct 12, 2011

i am trying to call a function which is defined in main.mxml

public function btnAcceptCall_clickHandler(event:MouseEvent)

[Code]...

View 3 Replies

ActionScript 3.0 :: Calling Function On Main Stage From Within A Movieclip?

Feb 9, 2010

I want to make 5 buttons visible after a logo has animatedI have a function called vis that successfully makes the buttons visible.How do I call this from within the movie clip (instance name 'logo'?)first frame of main timeline code:

stop();
function vis () {
webMC.visible = true;

[code].....

View 1 Replies

ActionScript 3.0 :: Flash Calling A Function On The Main Timeline?

Sep 27, 2010

So this was quite simple in AS2, but considering that _root is no longer around, how can I call a function that is on the main time line from a nested movie clip?

This is what I have inside my movie clip:

Code: this.hit_mc.addEventListener(MouseEvent.CLICK, updateScore); I tried using Stage.updateScore, but that didn't work either. This is the error I'm getting:

1119: Access of possibly undefined property Stage through a reference with static type flash.display:Stage.

View 2 Replies

ActionScript 3.0 :: Calling A Function Inside A Class From The Main Timeline

Aug 12, 2009

i am getting a "ReferenceError: Error #1069: Property beginTargetLock not found on AimCursor and there is no default value."

[Code].....

View 2 Replies

Actionscript :: Calling Function In A Mxml Component From A Main Flex Application

Dec 20, 2010

In my main application I have a viewstack with 3 child views. In the viewstack change handler, I programmatically change the selectedchild property.

I understand that the initialize method for the view is not called every time I change the selectedChild Property. So I tried to invoke the init method programmatically too..

view1.mxml
<fx:Script>
<![CDATA[

[Code].....

View 2 Replies

ActionScript 3.0 :: Calling A Function In A Loaded Swf?

Aug 1, 2009

I'm using FLex Builder and in my Main class I load an external swf. In the external swf there is a movieclip on the stage called house. In the library I have that movieclips Class name set to a class I defined called com.buildings.House

When I load the swf from the main class I'm trying to access a function called setup in the class called House. I have tried a bunch of different ways but I get errors for them all.

Code:
private function onLoadSwf( url : String) : void
{
var loader : Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoadComplete);
loader.contentLoaderInfo.addEventListener(Event.INIT, onLoadInit);

[Code]....

I'm at a loss right now and its driving me mad. In flash I used to use the var externalSwf : MovieClip = evt.target.content; example and it worked but with Flex Builder its throwing error saying setup is not a function.

With the Imap interface its saying externalSwf is null.

View 6 Replies

ActionScript 2.0 :: Calling Function From Loaded SWF

May 10, 2008

I have a movie (let's call it index.swf) that has a movie clip loader which is loading external .swfs Is there any way that I can call a function that is on the index.swf's main timeline from one of the externally loaded .swfs? Basically all I want to do is to be able to play another mc that is on the index.swf's main time line by pressing a button that is on one of the external swfs.

View 3 Replies

ActionScript 3.0 :: Calling A Function From A Contained/loaded Swf?

Mar 2, 2010

Have a swf that I am making (call it "contents") that gets loaded into another swf (call it "container") [pre-existing from someone else].How do I, from inside the Contents file I am making, address and execute a function from the Container movie?I know how to go from the container to the content file, but don't know the syntax the other way.Thought something like this should work but doesn't seem to:

Code:
if(this.parent.parent!= null){
var parentLevel:Object = this.parent.parent as Object;

[code].....

View 1 Replies

Actionscript 3 :: Calling Function In A Runtime Loaded Swf?

Dec 11, 2010

My problem specifically I am designing a user interface with controls on it. 5 buttons rotate left, rotate right, zoom in, zoom out, and auto rotate. The interface in itself works fine, I can trace out button clicks, toggle the auto rotate button etc...

My program reads an xml file. Loads some images, fills an array with links for each image, and when the image is clicked a loader loads a swf from a URL and displays it on screen. No problem.

Now I originally had the zoom controls user interface in the runtime_loaded.fla library, and the mouse listeners in the same linked document class. The interface works with the movieClip in runtime_loaded.swf when it is in the same code.

[Code]...

View 1 Replies

ActionScript 2.0 :: Calling A Function Inside Of A Loaded SWF?

Aug 27, 2009

I'm using loadMovie to load in an external SWF file. I'm looking to call a function called setText() inside of this swf. I can get to the function by doing this:

ActionScript Code:
toolTip = _root.createEmptyMovieClip("toolTip", _root.getNextHighestDepth());
toolTip.loadMovie("ToolTip.swf");

[code]....

but it's not working like this:

ActionScript Code:
toolTip = _root.createEmptyMovieClip("toolTip", _root.getNextHighestDepth());
toolTip.loadMovie("ToolTip.swf");
toolTip.setText(aTxt);

how I can do this without an enterframe?

View 3 Replies

Actionscript 3.0 :: Calling A Function In A Loaded SWF From A Parent SWF?

Jan 21, 2009

syntax for calling a function (and sending arguments) located in an external SWF from a parent SWF?

View 2 Replies

ActionScript 2.0 :: Calling A Function On A Loaded Clip?

Jun 16, 2006

So I can load in a movieclip fine, using MovieClipLoader. What I don't understand is how to access variables in the loaded clip, or, more importantly, how to call a function on the loaded clip.

Here's what I have as a test:

Code:
var game_mc = _root.createEmptyMovieClip("game_mc", 0);
loader = new MovieClipLoader();
loader.addListener(this);

[Code].....

View 2 Replies

ActionScript 3.0 :: Conflict Between Function In A Loaded-in .swf And The Main .swf?

Nov 17, 2009

I have one swf (let's call this 'A') that loads in an external swf via my own pre-loading class. We'll call this 'B'.s both swfs are written by myself, the structure follows the same one I always use, ie. a DocClass named 'Main'. When B is loaded in, the DocClass's clash - ie. B calls A's DocClass. a) Is this normal behaviour?b) Will this conflict occur for any other variables/functions that share a name?

View 3 Replies

ActionScript 3.0 :: Calling A Function Located On The Main Class From A Sub Class?

Nov 21, 2009

I'm not sure that I'm on the right track here. I've got what is essentially a 'gateway' movieclip and depending on the CLICK a corresponding movieclip (form) is loaded -- these all being in their own AS file. There are multiple corresponding pages that will all load/close in their own fashion but the 'gateway' will reload in it's own function-- consequently, I have this function on the main_AS.  Can I trigger this function from the sub class or do I need to move the 'reload' function to a 'reload' class.

View 2 Replies

ActionScript 3.0 :: Getting Loaded SWF To Use A Function From Main.fla Document Class?

Dec 16, 2009

I have a main movie with thumb movieclips that load new children and stops the main movie's animation. Within the child there is a close buttion that removes itself. I also wanted the close button to start the animation of the main movie again once it removed the child. Since I am using a document class to load everything for the main move, how can the close button from the loaded swf use a function from the main document class?

View 5 Replies







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