ActionScript 3.0 :: Nested Mc Button Calling Parent Function?

Jul 9, 2009

I have setup a video interface with a stock video player in the parent mc. In the same swf next to the player, I have a mc which is a video thumbnail chooser. The thumbnail buttons are located two levels down within this mc (nested within two mc) in order to facilitate the scrolling independent of the player. In the parent, where the video player lives, I placed a function:

function vid1(event:MouseEvent): void{
pubPlayer.source = 'Steve480.flv';
}

In the child mc where the thumbnail buttons are, I want to call the parent function like this:

vid1_btn.addEventListener(MouseEvent.CLICK, vid1);

None of my clips are externally loaded, just nested in the same swf. How can I talk up or down the movieclip ladder?

View 0 Replies


Similar Posts:


Actionscript 3.0 :: Nested Mc Button Calling Parent Function

Jul 9, 2009

I have setup a video interface with a stock video player in the parent mc. In the same swf next to the player, I have a mc which is a video thumbnail chooser. The thumbnail buttons are located two levels down within this mc (nested within two mc) in order to facilitate the scrolling independent of the player. In the parent, where the video player lives, I placed a function:

function vid1(event:MouseEvent): void{
pubPlayer.source = 'Steve480.flv';
}

In the child mc where the thumbnail buttons are, I want to call the parent function like this:

vid1_btn.addEventListener(MouseEvent.CLICK, vid1);

None of my clips are externally loaded, just nested in the same swf. How can I talk up or down the movieclip ladder?

View 2 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 2.0 :: Calling A Nested Function With SetInterval?

Jul 4, 2011

As entitled in this post, suppose we have wrote in timeline

[code]...

The problem emerges because I want to use local variables (i.e. a and b) to perform tasks of myF2 on several clips at the same time but started, say, a half of second one after the another. I don't want to use timeline variables because all clips must start with the same initial variable values.If it's impossible to use setInterval like this, how is it possible to fix the problem I described here? .This code is for Flash Professional 8.0

View 1 Replies

ActionScript 3.0 :: Calling A Function On Parent Swf

May 11, 2009

new to actionScript and trying to finish my final project, and i'm banging my head on a brick wall now, my question may be easy for some pros, basically i've loaded an external swf from a button at main.swf

[Code]...

this works fine. then i'm trying to disable the button function while the swf is loaded. I add another eventListener to the same button. function disableMenu( e:MouseEvent ):void { button1.mouseEnabled = false;}

that works too. ok now comes the problem. I have a close button on my child swf("content1.swf) to close itself and returen to main swf. but I want the button on main.swf to work again. so at the close button I add another eventListener hope to enable the menu. (note this is on the child swf!)

[Code]...

View 13 Replies

ActionScript 3.0 :: Calling A Function Of A Parent?

Aug 5, 2009

I have two movies... main.swf and content.swf, and I'm trying to call a function in my main.swf from my content.swf. Here is the code..

//function in main.swf
function appear (event:MouseEvent):void{
TweenLite.to(title1, 1, {autoAlpha:1, overwrite:false});

[Code].....

I got an error message as soon as i click on close_btn. It says appear() is not a property or method.

View 0 Replies

ActionScript 2.0 :: Calling Function In Parent Swf

Apr 13, 2010

So, my problem, I have a Parent swf file that loads a bunch of smaller swf files. When I click on a button in one of these loaded swf files, I want to be able to call a function from the parent swf. Once called, the function manipulates things MC's within the parent swf.

View 2 Replies

ActionScript 3.0 :: Calling An Function On Parent Swf

May 12, 2009

new to actionScript and trying to finish my final project, and i'm banging my head on a brick wall now, my question may be easy for some pros,[code]this child swf is loaded from xml. and the close button is created by using AS file. The "button1" is just on the stage of the main swf. Maybe these make some difference so i can't just point it back using (root)?Any idea how do I resolve this? Or am I not supposedd to do it this way at all?

View 2 Replies

ActionScript 3.0 :: Calling A Parent Function?

Jan 29, 2010

i have a swf that loads a swf that loads one swf into that one. i need the final swf (child, child) to be able to call a function on the first swf (parent)

i have tried this:

if(MovieClip(parent.parent.parent)!=null){MovieCli p(parent.parent.parent).parentFunctionCall();}

[Code]....

View 2 Replies

ActionScript 3.0 :: Parent Calling Child Function?

May 23, 2011

May i know how to call child function(layer 2) in parent(layer 1)?
 
Layer 1 (Parent)
function changeAction():void{
changeColor();
}
 
This method will give me the error -> Call to a possibly undefined method changeColor.
 
Layer 2 (Child)
function changeColor():void{
trace("success");
}

View 4 Replies

ActionScript 3.0 :: Calling Function In Child Swf From Parent

Jul 27, 2009

I have container swf which includes navigation that loads child swfs. Each child swf is loaded then visibility is set to false. Once a child ( an image gallery actually) is loaded it is possible to jump from image to image. What Id would like to be able to do is call a "clean up" function that returns the child to its initial state when anothor nav link ( a different gallery) in the parent is clicked. But I do not know how the syntax is supposed to be written or if its even possible.

Ideally it would look something like this in the parent container swf:

ActionScript Code:
function swapSectionIdentity(e:MouseEvent):void {
setChildIndex(background_home, 0);
getChildByName("identity_mc").visible = true;

[Code]...

the behavior I am attempting to avoid is when a child swf is loaded ( an image gallery) and then the child is invoked to display a particular image in it, afterwhich a main navigation link is clicked the current gallery is set to visible = false and a new gallery is set to visible = true. But when you return to the previous gallery the last image viewed is still showing. I want to be able to reutrn to galleries inital state as it is hidden. make sense?

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 3.0 :: Calling Function In Parent From External SWF?

Mar 17, 2009

I want to call a function in my parent movie from my external swf wich is loaded through a loader. Can anyone give me a nudge

View 4 Replies

ActionScript 3.0 :: Child Calling Parent Function?

Mar 17, 2009

I have setup a simple video interface. The video player lives in the parent swf. The video list chooser is loaded as a child swf. In this child swf, I have some video buttons nested within two movieclips in order to facilitate the scrolling feature. I am trying to get the movie buttons to load flvs into the component flv player in the parent swf. I have declared the functions in the parent and I am trying to call them in the child:Code in the Parent:

function vid1(event:MouseEvent): void{
pubPlayer.source = 'vid1.flv';
}

[code].....

View 9 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 :: Calling A Parent Function When Child .swf Closes

Apr 14, 2010

I am adding a child .swf from the parent with a simple button. If this button is then clicked multiple times, the child is added multiple times. So I added the ".visible = false"  to the button when clicked so the button cannot be clicked while the child is open.
 
Now, there is "Close" button on the child .swf that uses "this.parent.parent.removeChild(this.parent);" and would now need to set the parent button back to ".visible = true".
 
I have tried MovieClip.parent.parent.resetButton();  and  parent as MovieClip.resetButton(); and many variations of the code. I get no errors but the code doesn't work either.

View 2 Replies

ActionScript 3.0 :: Calling A Function Present In Parent From A Popup?

Aug 7, 2009

Basically i am trying to call a function which is present in one.mxml from a pop-up in two.mxml with a parameter.

one.mxml :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >
<mx:Script>
<![CDATA[

[Code].....

How to i call parent's method when i don't know who the caller is?

View 0 Replies

ActionScript 3.0 :: Nested Button Referencing Parent MC?

Dec 4, 2009

I am working on a tool for use in our office which creates XML. At this point I am working on getting an error message to appear when the user enters incorrect data in one of the textfields. I have a MC which contains my error message as well as a button. The button will move the MC back off of the stage. Everything works up to the point where I click the nested button. I suspect there is a problem in referencing the parent MC from the button.Here is the code for the entire project. I am sure there are more than a few errors since I am relatively new to AS

import fl.controls.RadioButtonGroup;
import flash.display.*;
load_file.addEventListener(MouseEvent.MOUSE_UP, do_load_file);//load file button click.

[code]........

View 0 Replies

ActionScript 2.0 :: Why Nested Button Will Not Move Its Parent

Jan 22, 2007

I have 2 child movieclips nested into one working parent movieclip, then the parent movieclip is animated. The nested working parent movieclip should move to the side once a child movieclip is clicked. Currently, the parent is unaffected by clicking on a child movieclip. What gives?

Below is a layout of the movieclip:
Button List Box
| |
v v
Subparent(groups btn and list box)
|
v
Parent(animated)

I need the parent to animate once the child Button is clicked.

View 4 Replies

ActionScript 3.0 :: Nested Parent Button Functions?

Jan 31, 2009

i have a nested swf that functions just fine.i have a parent swf (that holds the nested swf) that has a button (not related to functions of nested swf) that no longer works when combined.the button is simply a link button to a url... is there a very simple solution to this?

View 2 Replies

ActionScript 3.0 :: A Swf In An IFrame Calling Javascript Function On Parent Page?

Jul 14, 2009

I have a .swf that has to load in a iFrame and needs to call a browser cookie javascript function that lives on the parent page that loads the iFrame.I'm using this:

xternalInterface.call("javascriptFunction");

View 1 Replies

Actionscript 3 :: Using Events Vs. Directly Calling Parent Application Function From A Child In Flex / Flash Builder

Jun 21, 2011

If I need to call a specific function in the parent application from a child in a flex project, what's the best practice for this? Would it be to dispatch a custom event from the child and have a listener call that function? Or to directly call the function with FlexGlobals.topLevelApplication?

View 1 Replies

ActionScript 2.0 :: Function For Nested Button?

Dec 7, 2011

I have kept 12 buttons inside a Movie Clip. When I refer this with dot and when clicked it works fine. But the same is not working with function. This works

ActionScript Code:
scroll_mc.Feb.onRelease = function() {
var month:String;
month=this._name;

[code]...

Button and Label name of Scene is same i.e., Feb.

View 9 Replies

Only One Instance Of Same Button Calling Function?

May 17, 2009

I have 4 instances of the same button on a single layer in a timeline of the mc 'coverflow_mc' named 'ThatsMe_btn_a' to 'ThatsMe_btn_d' ie same button, same position.. it just changes instance name on 4 keyframes. Why does it call the function fine for button a but not for b,c, or d? There is a stop on each of these frames and I can see from the swf that it is stopping at the correct frames.
 
function thatsMe() {
right = new Sound();
right.attachSound("right");

[Code]....

View 3 Replies

ActionScript 3.0 :: Calling A Function When A Button Is Clicked

Apr 26, 2010

I have a function set up to stop a timer internal function pauseTiming():void { timer.stop(); } how would I call that function when a button is pressed, say with an instance name PauseTimer? I would also need to call the function startTiming when the button is pressed a second time. (or create two buttons, start and stop).

View 4 Replies

ActionScript 3.0 :: Calling Function When Button Clicked

Nov 11, 2011

I have these function which are called when the file is started. However how can I call it when I click a button:
function processXML(e:Event):void {
myXML = XML(e.target.data);
// after this executes you can call getXmlValues();
getXmlValues(nodeId,n,stopAtNumber);
} function getXmlValues(nodeId,n,stopAtNumber):void {
[Code] .....

View 10 Replies

Actionscript :: Calling Function From File For Button In Mxml?

Mar 14, 2011

Can anyone help me in this regard? I have Actinscript file in which I have defined a function like below:

actionScript.as (file name)
import mx.controls.Alert;
public function abc():void{
Alert.show("Inside abc(): My Button Clicked");
}

Now I have a button in mxml and I am calling the above function in my buttion "click" attribute like below.

Importing script in mxml:

[Code]...

View 1 Replies

ActionScript 2.0 :: Calling JavaScript Function From Flash Button

Sep 30, 2003

I can't get this to work. I need to call a Javascript function from a button in flash. The code is as follows:
on (release) {
getURL("javascript:nameOfMyFunction('whatever.html ')");
}

This is working, so I got the call right. But what I really want to do is have that url (html) to be a variable within flash.
on (release) {
Myurl="[URL]";
getURL("javascript:nameOfMyFunction('Myurl')");
}
This doesn't work. How do you use a flash variable as a javascript function parameter?

View 1 Replies

ActionScript 3.0 :: Button In Parent SWF Calls Function In Child SWF?

Mar 26, 2011

I do not want to use external .as files because I will have about 100 swfs to manage in this project, 100 swf is a lot of file management alone without adding 100 .as files on top of it.This is the code in the parent swf file to call the child swf and place it in the page_mc movieclip (note in my final project "child.swf" is replaced with the loading array variable but we're going to keep it simple):

ActionScript Code:
var pageLoader:Loader = new Loader();
page_mc.addChild(pageLoader);
var loadedpage:URLRequest=new URLRequest("child.swf");
pageLoader.load(loadedpage);

Now just for a simple function to call, we'll say we have a box_mc on the stage in the child swf, and when we click the button in the parent swf I want to call a simple function like this to hide it:

ActionScript Code:
function hideBox(event:Event):void {
box_mc.visible=false;
}

how do I call that function in the child swf from a button in the parent swf?

View 2 Replies

ActionScript 3.0 :: Calling Function With Event Listener Attached To Button

Jul 26, 2011

I have a situation where I'm calling a function with an event listener attached to a button, which in turn calls a function, which does a number things including calling a second function which resides in a child swf.

Just as an example:
Code:
myBtn.addEventListener(MouseEvent.CLICK, firstFunction);
function firstFunction(e:MouseEvent):void{
//I call another function in here (among other things)
externalSwf.stopTimer();
}

"StopTimer" resides in an external swf which for our purposes is called externalSwf and it resets a running timer.
Code:
function stopTimer():void{
myTimer.reset();
}

I'm getting argument mismatch errors, which often have to do with the Event Objects not matching. The event object for firstFunction is a mouse event triggered by a click so I put in e:MouseEvent...what I don't clearly understand is, what type of object event is dispatched when I call the function stopTimer from inside the function firstFunction?

View 6 Replies







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