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


Similar Posts:


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 :: 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 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

Actionscript 3 :: Flash Calling Main Timeline From Within A Movieclip Within A Movie Clip

Aug 16, 2011

I've looked through similar question on this site and can't find a solution, so here is my problem: I have a save function that saves some data.This function is in 1 movie clip in another movie clip. After the save I want to gotoAndStop(1) of the main time line not the current nested one. Below is the code:

[Code]...

View 3 Replies

ActionScript 3.0 :: Calling FLV / F4V Clips In Main Timeline And Checking If One Has Finished Playing

Mar 30, 2011

I'm working on a campaign website and I need to catch the deadline by tomorrow! I'm stuck. I hope somebody here could help me. Here's how I want to do it:Everything will happen in the main timeline / main Stage.

1. I have F4V clips that I want to load into the FLV Playback, placed in the main timeline (stage), every time the corresponding buttons are clicked. The buttons with questions and their actions are each placed in their corresponding MC. (is it possible? And is it possible to load different flv clips in one FLV Playback?)

2. The user is asked a question, they will have to answer yes or no before they can continue. So if they answer yes, "yes.f4v" will play, no then "no.f4v" will play. Then the corresponding clip will play and the next question will have to appear ONLY after the clip is done playing. How do you check if an f4v is finished playing? Does it matter whether you use FLV or F4V? (I have this one worked, see the code below)

I have made 2 setups:

- Setup 1 is I place an FLV Playback Component in the main timeline and I am planning to load all F4Vs in it when a corresponding button is clicked.

- Setup 2 is I create swf's of all the F4Vs and load the swf in the main timeline on certain frame into a blank MC.

View 2 Replies

ActionScript 3.0 :: Call A Function On Main Timeline From A Different Timeline

Jul 14, 2009

so here's the function on main stage:

[Code]....

and here's the code that wants to call this function in a another movie clip. I've attached this clip dynamicaly to the main stage as well.

[Code].....

How can i acess slideImage function on the main stage. in AS2 _root.slideImage(btnNumber); would work. How Would I do this in AS3?

View 7 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 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 :: 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 :: Calling Class Function From Timeline?

Dec 4, 2009

I have a MC1 with a class that controls it on my timeline. Within this MC there is a second MC2 which contains a short animation. During that animation i need a trigger that will call a method from the class attached to the main MC. MC1 is linked to CLASSMC1 contains MC2(short animation)MC2 calls a function in CLASS

Code:
package {
public class CLASS {

[code].....

View 1 Replies

ActionScript 3.0 :: Calling Function On Timeline From A Class

Apr 7, 2009

in my menuButton class I add an eventlistener but moveAlong is on the main timeline how do I call it?[code]

View 1 Replies

ActionScript 2.0 :: Flash 6 - Calling A Function On An External Swf Timeline?

May 12, 2008

I've tried looking everywhere for this answer, but I'm still at a loss. I'm beginning to think it's not possible or I'm just not looking in the right places.I have three swf files. The main container and then two external swf files being loaded into the main swf. Swf 1 (frame.swf) has a function on the main timeline that needs to be called from a button in swf 2 (toolbox.swf). My initial thought was to place the actionscript of frame.swf into a movieclip and call it from toolbox.swf using:_root.callFunction("PH", "doPhone");Although this would work, I cannot use this option. The actionscript of swf 1 must stay in the main timeline. Using a class file is not an option either. Is there any other way to call a function from the main timeline of an external swf?

View 1 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 2.0 :: Calling A Function To Change Frames In A Mc On Root Timeline?

Sep 26, 2005

I have created a function on the root timeline, to be called at a certain point (when the character is on a certain frame and so is the certain item, he loses a life)the lives_mc advances frame by frame to show lives being lost.heres the function

Code:
function loseLife(){
if(_root.lives_mc._currentframe=1){
_root.lives_mc._currentframe=1[code].....

View 7 Replies

ActionScript 3.0 :: Controlling Main Timeline From Loaded SWF

Nov 2, 2010

I have a simple swf called site.swf that loads a menu with UILoader called menu.swf, from menu I'm able to navigateToURL but I also need that it goes to frame 50 in menu.swf.

View 1 Replies

ActionScript 3.0 :: Referencing The Main Timeline From A Loaded Swf?

Jun 14, 2009

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).

View 4 Replies

ActionScript 1/2 :: Getting Back To Main Timeline In Loaded Ext. SWF

Jul 7, 2009

I have a project I'm working on where the user is presented with an overhead shot of a building and is able to mouse-over the different rooms to choose one to "enter." Once clicked, the chosen room is an external .SWF that is loaded that has options to view other external .SWFs within that room. Problem is, within the first loaded .SWF, I have a "home" button that is supposed to take the viewer back to the main overhead view but I can't get the AS to work. I've tried _parent and _root with no luck (not sure I even typed out right code).

View 29 Replies

ActionScript 3.0 :: Control Main Timeline From Loaded Swf

Aug 24, 2010

I'm using a textfield for debug information.I'm loading an swf on the main timeline and I'm showing the status in the debug textfield.[code]I'm loading a png file in the loaded swf. , I'm trying to show the status of the png file as I showed the status of the swf.[code]I can't control the main swf from inside the loaded swf. Even gotoAndStop or calling a function doesn't work.Do I need to add something when I load the swf, saying it's a MovieClip or something?URL...

View 3 Replies

ActionScript 3.0 :: Accessing Main Timeline From Loaded SWF

Mar 11, 2009

I have a question about accessing functions or variables on the main timeline from a loaded swf. I know that there are a few ways to do this

1. Casting the timeline as a movie clip
Loader SWF Script
var testText:String = "Test";
var myLoader:Loader = new Loader();
loadData("loaded.swf");
function LoadData(aURL){
myLoader.load(new URLRequest(aURL));
addChild(myLoader);
}

2. Cast the timeline as a generic object
var parentObj:Object = this.parent as Object;
parentObj.unloadSWF("loaded.swf")
Why can you not just reference the main timeline of the container swf directly.

View 5 Replies

ActionScript 3.0 :: Control Main Timeline From Loaded Swf?

Nov 2, 2010

i have a simple swf called site.swf that loads a menu with UILoader called menu.swf, from menu i'm able to navigateToURL but i also need that it goes to frame 50 in menu.swf..

View 2 Replies

ActionScript 3.0 :: Controlling Main Timeline From Loaded Swf?

Feb 22, 2011

So basically I have two swfs, main.swf and level.swf.. main.swf simply has two frames, first one has the code below to load level.swf and the second frame has some text in it, it's labelled "theend".

Code:
var request:URLRequest = new URLRequest("level.swf");
var loader:Loader = new Loader()
loader.load(request);
addChild(loader);

level.swf is more complicated, it's a little game and blah blah, but the thing is that I have a button (cnt_btn) in the last frame. I'd like this button to go to the second frame ("theend") of the main timeline.

View 2 Replies

ActionScript 2.0 :: Loaded Swf Interfering With Main Timeline?

Dec 11, 2009

I have a main flash movie, which I'm using to display various other smaller swf's.All the SWF's including the main one are set to flash player 8, action script 2.Script used is:loadMovie("swf/movies/moviename.swf", "p2");This is loading the swf into a correctly sized and placed movieclip with instance name "p2"This all works perfectly well apart from one particular swf. It has various script in it that seem to be interfering with the timeline of my main movie. Causing it to start playing, when it should be stopped etc. It seems to cycle through all the other keyframes until it gets back to keyframe that it sits on.

Is there a way of making sure none of the script within the loaded SWF will effect the main movie that it's loaded into?I tried usingthis._lockroot=trueon the 1st frames of the SWF's to be loaded, and also on the 1st frame of the main movie, but it does not work.I also tried loading to various levels, with no luck.Something in the externally loaded SWF's is causing the main movie timeline to go crazy. I guess either the interval timer or the endcount.Here's some of the code from the external swf thats being loaded into the container:

this.stop();
pause = function () {
play();

[code].....

View 4 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 Class Function From The Timeline Of A Nested Movie Clip?

Aug 26, 2010

I'm trying to call a function called checkForHit() located inside of my Hero class at a particular frame of an attack animation of my Hero object. Meaning, when his weapon is at the point in the animation where it could collide with any enemies, I want to call the function that performs the check.My Hero Movie Clip is set up where it contains a Movie Clip on different frames that coorespond to the different animations (attacks, movements, etc). So the Hero MC contains a bunch of other MCs. That way I can just use hero.gotoAndStop("attack1");

The problem that I'm having is that the code that I wrote to call the checkForHit() function is written on one of the frame of the nested MC's timeline, and it's not being recognized. In fact, even if I put a trace("HELLO") on any of the frames on the nested MC, it's not being output. I even tried to put something that I know should cause an error on one of the frames, and it ran without throwing an error. It's almost like the code on the timeline isn't being compiled, or it's being skipped over somehow.

View 1 Replies

ActionScript 3.0 :: CS4 - Communication Between Loaded External Swf And Main Timeline?

Feb 4, 2010

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.

View 2 Replies

ActionScript 3.0 :: Getting An External Swf To Be Loaded On A Page In Main Timeline?

Sep 25, 2011

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.

View 5 Replies







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