ActionScript 2.0 :: Targeting Buttons Parent Versus Root?

Feb 19, 2010

I have a main flash movie that loads three external movies, the external movie buttons don't work when loaded onto the stage.
In each external swf thats loaded, the button actionscript is in this form:

HTML Code:
on(release) {
_root.gotoPage(2);
}

And this works when each swf is loaded stand-alone. But not when loaded as an external swf.With the numbers ranging from 1-19 as far as pages. How should I edit the code so that these buttons work when loaded externally?

Code:
on(release) {
_parent.gotoPage(2);
}

[code]...

View 0 Replies


Similar Posts:


ActionScript 1/2 :: Reference Parent Without Using Parent Or Root?

Mar 16, 2010

I cannot use the following in my ActionScript due to conflicts with the host application:

_level0
_root
_parent references

On a pop-up box I have a close button with an absolute reference: closeBtn.onRelease = function{ unloadMovie("_level0.Page_1.holderBox");} Is there another way to make this work without using _level0 or _parent? I've read that it is possible to use a global variable on the main timeline and ref that, but cannot get that to work.

View 7 Replies

Flex :: Parent App Access Versus Events In Modules

Feb 2, 2010

Inspired by this Flex question, is it seen as better practice to dispatch an event back to the parent app, as opposed to calling a method on the instance of the parent app, from within a module? To me it seems that the module shouldn't know what methods are available at the parent, as such approach leads to tight coupling.

View 1 Replies

ActionScript 3.0 :: MovieClip With Button On Main Timeline - Targeting Root?

Oct 31, 2011

If I have a movieclip on the main timeline, and a button in that movie clip. How would I go about getting it to advance the main timeline to its next frame? I understand that in AS3 movie clips are not connected to the timeline in the same way as they are in AS2 but I dont understand why the following works, or if there is a better way?

stop();
next_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler1);
function mouseDownHandler1(event:MouseEvent) {
MovieClip(this.root).nextFrame();
}

View 2 Replies

ActionScript 3.0 :: Targeting A Parent's Function?

Aug 13, 2009

I've created a Preloader.as class. When the preloader finishes loading, I'd like it to call a function from it's parent (the document class).This is the error I get:

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

[code].....

View 9 Replies

ActionScript 3.0 :: Targeting Parent Of Clicked MC?

Feb 2, 2011

this one's driving me crazy. I've got a button embedded in a MovieClip. When the user clicks the button (from the stage level), I want to return what MC the button's parent is, so that I can pull some variables from the parent.

HTML Code:
public function buttonClicked(e:MouseEvent)
{

[code].....

View 1 Replies

ActionScript 3.0 :: Targeting A Parent Movie Clip?

Mar 18, 2010

this is weird, ive tried all my resources and cant come up with the solution.

heres the heirarchy

Main Stage

sampleStage_mc (this contains all my samples)

sampleStageNavigation_mc (this is the movieclip that houses my buttons)

............................................

what i want to happen is when you click on one of the button_mc, i want it to target a frame label on the "sampeStage_mc" timeline.

heres my code:

Actionscript Code:
toshibaBtn_mc.addEventListener(MouseEvent.CLICK, toshibaSample);function toshibaSample(evtObj:MouseEvent) {    parent.gotoAndPlay("toshiba");}


theres four timelines, here is the outline

button_mc (i click this and it runs the code in sampleStageNavigation timeline)
sampleStageNavigation_mc (timeline that holds the ActionScript and the button_mc)
sampleStage_mc (timeline - this is the one I need to access)
main stage (timeline)

View 10 Replies

ActionScript 3.0 :: Targeting Parent Swf Holder Mc To Load New External Swf?

Dec 1, 2009

I have a main swf that loads external swfs into a holderMC. How do I get a button called playnext_btn on each external swf to tell the main swf to load a new external swf into its holderMC? I used this code in the main swf to do the initial load of the first external swf into holderMC:

Code:
var swfLoader:Loader = new Loader();
holderMC.addChild(swfLoader);
var bgURL:URLRequest = new URLRequest("benefits.swf");

[code]....

View 3 Replies

Actionscript 3.0 :: Targeting Parent Swf HolderMC To Load New External Swf?

Dec 1, 2009

I have a main swf that loads external swfs into a holderMC.

AS3

How do I get a button called playnext_btn on each external swf to tell the main swf to load a new external swf into its holderMC?

I used this code in the main swf to do the initial load of the first external swf into holderMC [code]...

View 6 Replies

ActionScript 3.0 :: Use Stage SubClass As Root / Parent

Dec 19, 2010

Is there a way to tell flash to instantiate a Stage subclass called "TheStage" instead of the default Stage class as root/parent of my document class?
public class TheStage extends Stage{
//code
}

Then when I do "DisplayObject.stage" I want it to return the instance of TheStage instead of the default Stage insteance. I want to do this so that I can override the addEventListener method of the Stage class. So if I call DisplayObject.stage.addEventListener I can execute my own code routine. Is that possible and how?

View 8 Replies

ActionScript 3.0 :: Accessing Parent Root From External Swf?

Jul 23, 2009

I am able to access main root from an external swf by doing this:

MovieClip(root.parent.root)

but how to avoid getting an error when testing external swf alone? Is there any try catch system I can do to avoid thoses errors?

View 1 Replies

ActionScript 2.0 :: Real Difference Between Root And Parent

Feb 14, 2005

So What is the Real difference between .root and . parent??? I need to know the difference between the two are.

View 1 Replies

Actionscript :: Retrieve An Xml Nodes Root / Top Level Parent?

Jan 3, 2012

how do i retrieve the top level parent of an xml node in actionscript please?

<companies>
<company id="1" name="boo" level="1">
<company id="2" name="hoo" level="2">[code]......

View 1 Replies

ActionScript 3.0 :: Controlling Root And Parent From External As File

Dec 4, 2010

I am trying to create a global function to reuse repetitively. It worked until I moved the function to the external .as file. The problem is with MovieClip(root) and MovieClip(parent). They do not work and cause errors.

[Code]...

View 0 Replies

ActionScript 3.0 :: Nested Child Calling Root Parent Function ?

Jul 18, 2010

I'm switching from as2 to as3 and everything was going swimmingly with my new site until i tried to use a _root call to a function on the main timeline by a loaded movieClip that is loaded nested into 2 other movieclips. the movieClip needs to tell the _root when it's done playing so the root knows to load the next one in line through a php call. Everything works except for the _root call. In as3 there's no such thing as root anymore so I figured no big deal, i'll just find out what the new thing is and holy crap wtf! I can't figure this out!! I've read from doing stuff like custom eventLisnters (which i am trying now) and casting the root as a movieClip and then I read this whole crazy tutorial on building an event structure and the proper MVC way of coding and blah blah blah ALL I WANT TO DO is tell the _root that the loaded MC has reached the end of its timeline. Basically if it were as2 i could just go _root.loadNext(); and it would work.how to make a loaded MC talk to the _root timeline and call a funciton from there?

View 19 Replies

ActionScript 3.0 :: Root And Document Class For Child SWF Loaded By Parent SWF?

Feb 12, 2011

I'm using a PreLoader as a parent SWF that loads the actual website as a child SWF. In the website SWF, the child SWF, will MovieClip(root) still work and refer to it's own root, or the PreLoader's root? And would I still access the websitite's document class (the child's document class), through MovieClip(root)? What if both files have a document class?So my main question is how do document classes and MovieClip(root) behave in the scenario when you have:

Parent SWF - document class, MovieClip(root)
|
Child SWF (loaded by parent) - document class, MovieClip(root)

View 2 Replies

ActionScript 3.0 :: Scope To Access The Stage Property With Root Or Parent - Error 1119

Mar 7, 2009

I have a MainClass from where I can call Stage. In the MainClass I call another class named Subclass, and in that one I call my ThirdClass. ThirdClass is initialized fine, but my problem appears when I want to call the Stage within the ThirdClass, to align the Stage. When I compile I receive the message: 1119: Access of possibly undefined property align through a reference with static type Class.

[Code]...

View 4 Replies

ActionScript 2.0 :: Targeting Buttons In Attachmovie?

Nov 12, 2010

On keyframe 5, I have an attachmovie script;

Code:
_root.attachMovie('chapter_3mc','chapter_3mc',12);
chapter_3mc._y = 182;

[code]....

View 4 Replies

Actionscript 2.0 :: Targeting Buttons In An Array?

Feb 5, 2009

i have a series of buttons in an array, and i want to change the alpha of all of the buttons when a button (outside of this array) is clicked. i can change the alpha of all of the buttons inside the for loop, but not when the button is clicked. (the button is functional and being referenced correctly, as the trace does work.)what do i need to do differently to be able to control these buttons?

Code: Select all
var theBtns:Array = [btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8];
for(i=0;i<theBtns.length;i++){

[code]....

View 3 Replies

ActionScript 2.0 :: Targeting Buttons In A For Loop?

Aug 5, 2007

I had the following script which worked fine for my buttons which were sitting on the stage and are called 'btn1', 'btn2', etc... However I wanted to animate all the buttons so have put them all into a movie clip called buttons, but now my script doesn't work, I have tried changing all the this targets to _root.buttons.this,

Code:
numOfBtn = 5;
stop();

[code]......

View 1 Replies

ActionScript 2.0 :: Targeting Movie Clips From Buttons Within Other Mcs?

Feb 27, 2010

I'll try and make this as clear as i can, so as not to waste your time. I think it's something really simple i'm just missing...On the main timeline, i've got a movie clip ("mc_A") that contains two other movie clips ("mc_1" and "mc_2").at the end of it's timeline, I put a button in "mc_1" to play "mc_2". I'm using

on (release) {
telltarget ("_root.mc2") {
play () ;

[code].....

View 1 Replies

ActionScript 2.0 :: Targeting External JPG's Inside Buttons?

Mar 22, 2010

What I'm trying to do:I have an external JPG. I want to treat it as a button. on mouse over, I want it to fade in. However, I'm having problems understanding how to target this in my SWF.So 2 questions, can you target an external JPG to a Movie Clip inside my button? how do I target that?

View 1 Replies

Flash :: Targeting Multiple Buttons And Get Different Value By Clicking Different Button

Aug 8, 2011

I want to target multiple buttons and get different value by clicking different button.

Suppose there are 3 buttons: "button01", "button02, "button03".

This is my code:

var targetArr:Array = ["button01","button02","button03"];
for (var i:int = 0; i < targetArr.length; i++)
{
var target = getChildByName(targetArr[i]);

[Code]....

Instead of getting different value by clicking different button, I constantly get "3" as the value. I want: clicking "button01" will get "0" as the value, clicking "button02" will get "1" as the value, and clicking "button03" will get "2" as the value. How to do it?

View 1 Replies

ActionScript 2.0 :: Targeting Duplicates II - Put Several Buttons On The Stage When Clicked

Jul 9, 2004

I attached a movie that I am working on. I use the duplicate actionscript to put several buttons on the stage when clicked. I then want to be able to use the color picker to change the background behind the buttons. As of right now it only works on 1 button and by changing the 6 in this code for (i=1; i<6; i++) to 5, 4, 3, 2 or 1 it will only change that button. How can I get them all to change at once?

View 1 Replies

ActionScript 2.0 :: [FMX] Targeting HTML Frames With Flash Buttons?

Nov 26, 2002

I wanted to load .SWF files with flash buttons on a website into <iframes>

BUT the buttons are not separate (not separate .swf's) they are all in a sliding menu.

So how do i attribute those buttons on the sliding menu to open up files in a specific frame on a website?

View 3 Replies

Parent/root Functions, Importing The "children"?

Nov 11, 2009

I have an swf file, MyRoundButtons, which is a set of radio buttons I built (not components). It works fine, but if I import it into a parent it won't work anymore. I have to write a script to load it into a movieclip, (which I hate, because I'll have a several different swfs to assemble on my final stage. I really want to see them all on the stage together, not just at runtime.)Even when I load it into a clip and the buttons work, however, it doesn't seem to have a separate timeline when double-clicked ,and: I can't make the imported buttons control the timeline of the parent. I defined a test function:

Code: Select allfunction goToNirvana() {gotoAndPlay("nirvana")};

Frame "nirvana," in th parent, has a Trace instruction in it.goToNirvana works on its own in the parent. Now to call the function from within the child:

Code: Select alltv_btn.onPress = function(){
gotoAndPlay("TV");
// That last part triggers the button's down state and sound in the child timeline, in frame "TV."

[code]....

Whether I define that function in the child, the parent, or both, the instruction won't work. Now, I'd prefer not to do the loadMovie thing at all if I can avoid it, I'd rather have fully rendered button clips onstage at authoring for me to arrange and move about, with fully independent timelines right there. But you see what I'm trying to do. I just can't get it done.

View 2 Replies

ActionScript 3.0 :: Buttons In Movieclip That Need To Have 2 Functions In The Root

Sep 10, 2008

Even though i know not much of actionscripting, i like to make sites that are flash-based, so i keep on challanging myself with that. But now i stumbled into something, and i just cant find a solition! here is my problem: I have made dropdownmenu's in a movieclip and the mc works with hittest like this:

[Code]...

View 1 Replies

ActionScript 2.0 :: Controlling Buttons Inside MC's From Root Timeline?

May 8, 2008

I have a Nav Bar on my _root timeline. Inside of which I have buttons and MC's. I want to have all the code for my buttons on the _root timeline. So, I can adjust from there.

Below is an example of what I'm trying to do from the _root timeline Actions Layer:

Code:
// ------ NAV BAR ON MAIN STAGE -----------------------------------
// ------ Instance Name = NavBar ------------------------------------
// ------ Button inside of "NavBar" = MyButton ----------------------

[Code].....

View 8 Replies

ActionScript 2.0 :: Linking Buttons Inside A Movieclip To A Root Frame?

Feb 18, 2009

I've been working on a new issue while giving a break on cracking the other one.I have a movie clip acting as a button with rollover/rollout animation- we'll call it menu_mc for simple reference.I'm basically creating a rollover submenu. I've set it up a few different ways but the most user friendly has been hiding the submenu_mc (which has 4 linked buttons to root frame inside) by doing:_root.sub5_mc._visible = false;then inside the menu_mc with the rollover I have the submenu trigger set to show: _root.sub5_mc._visible = true;The links are working fine but the problem I am running into, is that the rollover state, once over the submenu_mc, does the rollout function and leaves the submenu_mc hanging there by itself- still functioning perfectly.You can go back over the menu_mc and it will play out the rollover again.On the other simple animated buttons (which do not have submenus) I have coded:

on(rollOver) {
_root.sub5_mc._visible = false;
}

[code].....

View 3 Replies

ActionScript 3.0 :: Parent Is Null, Root Is Null?

Aug 7, 2010

I created a Sponsorbar which dynamically adds sponsors according a XML script.

ActionScript Code:
for each( var imgPath2:XML in xdata.img )
 {[code]...........

View 2 Replies







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