ActionScript 2.0 :: Targeting Button Nested In Another MovieClip
Feb 27, 2008
I built a button, but as a movie clip. It's nested with in another movie clip on the main timeline. How do I go about targeting the button?- when I have it on the main timeline, it works fine. But once it's nested. The action script can't find it.
Here is the code I'm using:
btn1.onRollOver = function () {
this.gotoAndPlay("in");
} btn1.onRollOut = function () {
this.gotoAndPlay("out")
}
View 10 Replies
Similar Posts:
Jan 26, 2010
I have a main swf that loads an external swf (WNC.swf). The external swf (WNC.swf) contains a scrollPane that loads another external swf (WNC_DATA.swf). I'm trying to target the WNC_DATA.swf from the main swf, so I can tell it to go to frame (2). The following code targets the first child swf (WNC.swf), however I'm unable to target WNC_DATA.swf inside the scrollPane.
[Code]...
View 5 Replies
Oct 13, 2011
I always face this problem when coding with flash, and still not able to get a solution for this problem....
if the nested mc is in the 1st frame then I can use: Level1_mc.Level2_mc.Level23_mc.gotoAndStop("2");
If refering nested btn I will use: MovieClip(parent).gotoAndStop("2");
so my question is, how about refering an mc from main timeline into nested mc but different frame( frame 4,5 or 6....)?
View 6 Replies
Jun 1, 2009
On my main timeline, I have a movieclip called "mainpage". Within "mainpage", I have a button that when clicked upon, needs to go back to the main timeline, into another movieclip, and to a specific frame in that movieclip. The code I've been using for all my other buttons is this:
Code: Select allfunction goAdler (e:MouseEvent):void{
MovieClip(parent.parent).gotoAndStop("adler");
}
adler_proj_btn.addEventListener(MouseEvent.CLICK, goAdler);
In that particular case, the button is going up to the parent movieclip of it's parent to a specific frame label.The problem I'm having is that I need for this button within "mainpage", rapp_proj_btn, to go to the main timeline, go into a movieclip a few frames down called "portfolio_content" (on a frame labelled "Portfolio"), and to a frame labelled "rapp". No matter what I've tried, I can't seem to target the "portfolio_content" movieclip, even though I've put the instance name on it and everything. I can, using the code below, get the rapp_proj_btn to go to "Portfolio", but I can't get inside that "portfolio_content" movieclip that sits on that frame.
This is the code I use to get to the proper frame:
Code: Select allfunction goRapp (e:MouseEvent):void{
MovieClip(root).gotoAndStop("Portfolio");
}
rapp_proj_btn.addEventListener(MouseEvent.CLICK, goRapp);
I tend to get an error describing not being able to get to an undefined property called "portfolio_content", and to be honest, in AS3, I'm not exactly sure how to go about fixing that error. I've tried calling the "portfolio_content" instance name in the code (right before gotoAndStop), but it doesn't recognize the movieclip.
View 12 Replies
Jul 9, 2009
How do you target a certain frame number/name from outside of that specific movieclip?
Code:
whoweare.addEventListener(MouseEvent.CLICK, whoweareClick);
function whoweareClick(event:MouseEvent):void{
gotoAndPlay("whoweare");
}
I'm assuming it's something with the gotoAndPlay function... but I've tried numerous things with that and nothing is working.
View 3 Replies
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
Jul 13, 2006
I am creating a drop down menu and having problems adding problems to the nested MCs. I have all the actions on the root timeline and I have a one Main_MC which holds several Sub_MC's.I have the Main MC animated fine but I can't find how to control the Sub-MC's.Here is a sample of my code and I have tried _root. and this. and show below but I can't get it to work.
//main MC
Main_MC.onRollOver = over;
Main_MC.onRollOut = out;[code].....
View 9 Replies
Feb 25, 2010
Here's my example, on frame 1 is an mc I created named holder. Inside there's an mc named box. Inside box are four mcs, circles1-4, inside the circles I have four skulls. If I want to affect only the skulls, what is the proper way to go about it?For instance, whats the proper way to write a trace statement?or , if I wanted the skulls to fade individually on mouse over, how would you properly go about writing this function?
function over(evt:MouseEvent):void{
evt.target.alpha = .5;
{
[code]....
View 8 Replies
Jul 23, 2009
I use the loader class to load in an external swf, a preloader movie in my class. (not a document class)
To target the properties in the swf (specifically the text field in it), I coerce it to a movie clip after it's loaded and add the child with:
var thumbPreloaderMC:MovieClip=evt.target.content as MovieClip;
now I can use:
thumbPreloaderMC.preload_text.text "sometext";
to reach the text field. works.
But, I want to nest that clip in a container movieclip I'm placing all the thumbnails I'm loading in, thumbContainer.
So I create the movieclip thumbContainer, add the child, then add the preloader swf to this clip.
I can't name the loaded swf, it throws an error, I googled that and see I can't name an already named clip.
I get an error "TypeError: Error #1010: A term is undefined and has no properties."
First of all, I'm fairly green with as3 still, I think perhaps I should rethink how I'm structuring this. I could and would ask how to target a nested loaded swf from a class.
is nesting clips like this from a class bad practice? What are best practices when it comes to using timeline based animations like preloaders etc by a class? I'd like to make my class as reusable as possible, but one can't create all animations and graphics from code.
View 1 Replies
Oct 12, 2009
I have a movieclip added to the stage through a function.
ActionScript Code:
function myFunctionOne():void{
var myClipA:clipA = new clipA();
myClipA.name = "myClipA";
addChild(myClipA);
}
To access this item on the stage I have to use:
ActionScript Code:
getChildByName("myClipA");
I have some other movieclips INSIDE this clip that have also been dynamically added. If I want to reference one of those clips I have to reference them by name using getChildByName.
[Code].....
But is there a better way to reference movieclips if they are created inside a function, or is there a way to create them so they are always globally accessible?
View 1 Replies
Jul 20, 2010
I created a drag N drop .swf that works great until i pull it into the main movie. The drag works, but not the drop. I know its level's issue/pointing and the targets arent being read correctly by the main..
View 1 Replies
Feb 17, 2010
I'm dynamically creating movieclips with dynamically created movieclips inside them and am having trouble with targeting them.
Below is a simplified example of what I'm trying to achieve, in the real file there are a lot more movieclips and I'm creating and naming them with a for loop.
This one is just one Sprite created inside another sprite. I can target the top level sprite named "testname". However when i try target the nested MC it throws an error.
The bottom couple of traces are just test MCs I've made to make sure i got the syntax right, on targeting nested movieclips.
PHP Code:
var holder:Sprite = new test1();
holder.name = "testname";
this.addChild(holder);
[Code]....
View 5 Replies
May 14, 2009
I am trying to design a menu system that pops up which I have just about managed. however nested in the menu movie clip are a number of other movie clips which I want to use as buttons but I am having problems getting the movie clips to load a swf once clicked. I tried putting a button in side the menu movie clip and it would not even recognize the mouse over which makes me think you can not nest buttons or movie clips in another movies clip?
Here is the code
import mx.transitions.Tween;
import mx.transitions.easing.*;
import flash.events.Event;
menuMC.flowerB.onRelease = function() {
loadMovie("test.swf", 1999);
[Code] .....
View 2 Replies
Oct 24, 2009
I'm trying to get my own buttons to load FLV movies into the FLVplayback component. I've got it to work in a simple test but making it work on a more complex level. The test is here I've named the FLVplayback instance 'my_video'The simple buttons have this script in the actions:
n (release) {
my_video.load("videonamehere.flv");
my_video.autoPlay=true;
[code].....
View 1 Replies
May 17, 2010
I created a MovieClip and added it to the stage(addChild). Next, I created a Button (exactly BaseButton) and I added it to the MovieClip.The case is it won't show up. When I add directly my button to the stage (my Main class is document class ) there is no problem. But I want it to show up in my MovieClip and I dont know what I am doing wrong =[.The addChild is working because when I
Code:
trace(controls.getChildAt(0),getChildAt(0));
I am getting
[code]........
View 0 Replies
Jul 17, 2008
I am trying to play a nested movieclip by clicking on a button. I have an instance name for the nested moviclip, and this is the code I atatched to the button:
on (release) {
_root.conference.gotoAndStop(35);
}
Nothing happens when I click the button with that code. However, if I take out the instance name, the button will play the frame specified:
on (release) {
_root.gotoAndStop(220);
}
View 2 Replies
Jan 7, 2010
I have a 2 movieClips on stage. One is a holder to load the images into, the other has buttons nested inside. The button will not load the image.
Here's the code:
btn1.onRelease = function() {
holder.loadMovie("one.jpg");
}
I'm sure that it's due to _root or similar but I'm not too sure how to apply it properly if so. I've attached the .fla
View 3 Replies
Jan 23, 2010
I've made a flash movie which will load four movie clips at runtime. Actually, the number of movie clips will depend upon number of "NODE" in XML file. Keeping XML file thing aside, I've tried hardcoded values; 4. Let me describe you the structure very well: There is a main empty movie clip, instance name "mc_scroll" which will be only item on stage. In this movie clip, another movie clip whose identifier name is "blueMovie" will be loaded dynamically. Inside this "blueMovie" MC, there is a button instance name is "blueButton" and inside this button there is a "Dynamic Text" field instance name is "btn_text".
mc_scroll->blueMovie->blueButton->btn_text
Now, I can load 4 or any number of "blueMovie" inside "mc_scroll". But I also want to set the button text for each button inside each MC!! But its not working. Below is the code:
Code:
//INSIDE THE MAIN TIME LINE
for(i=0; i<4; i++) {
txt="blue"+i;
mc_scroll.attachMovie("blueMovie", txt, mc_scroll.getNextHighestDepth(), {_y:50*i+5, _x:5});
mc_scroll.txt.blueButton.btn_text.text = txt;
[Code] .....
How to assign the text dynamically which is inside a button and this button inside a MC which is created dynamically inside a main MC! I've attached the FLA also.
View 1 Replies
Dec 11, 2009
I have created a world map that has each region of the world as a rollover. When you rollover the US, for example, it turns red and a movieclip pops out to display some info...it's basically a graphic I created in Illustrator that is a rectangle with info written on it.
The rollover works fine and everything pops out, but when you move the cursor close to the popout, it thinks you have rolled off the US. When you hit the edge it pops in and out almost like it is blinking.
How can I make it so that they are one hit area? Here is some of the code:
na_mc.buttonMode=true;
setChildIndex(na_mc,0);
na_mc.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);na_mc.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
[Code]....
View 7 Replies
Feb 5, 2010
I have a button inside a movieclip. When the button is clicked I want it to make a movieclip in the main timeline go to a specific frame. what's the code I need to use to define that movieclip located on the main timeline? Right now I have my code written inside the movieclip where the button is located because I have multiple buttons on multiple frames, and I don't know the syntax to define a button in a specific frame inside a movieclip.
Here's my current coding...
Code:
Select allfunction bwbtn2(btn:SimpleButton,frame:Number) {
btn.addEventListener(MouseEvent.CLICK,function() {photobw_img.gotoAndStop(frame);});
}
bwbtn2(bw19_btn,19);
View 2 Replies
Dec 30, 2009
I have a main.fla which has 3 movieclips inside it. All 3 mc's have timelines that run 40 frames. The main.fla timeline has each mc instance on a frame. mc_1 is on frame 1 mc_2 is on frame 40 mc_3 is on frame 81 as the main timeline plays the clips each one fades to the other. I need to know how to target this scenerio after mc_3 plays I need to have a goToAndplay (20) set up so the animation inside mc_1 starts playing (frame 20) of mc_1.
View 5 Replies
May 18, 2010
On the stage I have a movieclip called mc_back. I also have a movieclip on the stage called mc_content. Now, inside mc_content I have a bunch of code and some of it adds, or should add, an EventListener to mc_back as well as a a function that works when mc_back is pressed.
So basically, all code is written inside mc_content and some of it needs to interact with mc_back.
how to target mc_back from inside mc_content. Using stage.mc_back or root.mc_back doesn't work and Google should be my friend, but in this particular problem, it's acting more like my enemy.
View 8 Replies
May 3, 2011
I have a mock up fla file showing what i am trying to attempt. I have a button nested in a movie clip on the second frame on main timeline called PageBackBtn. I am trying to get this button to target a label within a movieclip on the first frame of the main timeline. The label also is called PageBackBtn within the movieclip on frame one.
View 0 Replies
May 4, 2011
I have a mock up fla file showing what i am trying to attempt. I have a button nested in a movie clip on the second frame on main timeline called PageBackBtn. I am trying to get this button to target a label within a movieclip on the first frame of the main timeline. The label also is called PageBackBtn within the movieclip on frame one.
View 1 Replies
Oct 28, 2006
i have a for loop and i want to do things with it:
for(i;i<=2;i++){
if(box+i._width>20){
var box_width:Tween = new Tween(box+i, "_width", Elastic.easeOut, 750, 20, 3, true);
[Code]....
View 5 Replies
Jul 28, 2007
Im trying to target a movieClip one level up... i could use _root but its not doable in this case?
View 7 Replies
Apr 28, 2009
so I am building a image scroller, that is fairly simple, but I am really having a hard time with targeting the clips inside the main clip. Here is the code that makes the scroller either visible or not :
mouseOverClip.onRollOver = function() {
TweenLite.to(mouseOverClip, .5, {_y:107});
mouseOverClip.rotateImg.gotoAndPlay(2);
[code]....
now in mouseOverClip, I have a clip called clipA that I need to perform a function when the mouse rolls over, however since the mouseOverClip is "listening" for the mouse over/out, its ignoring clipA. someone help! Im thinking there should be logic inside the rollOver to check what clip im over and to perform a function if that is true....
View 1 Replies
Jan 5, 2010
I know what the error 1061 means, but have no idea how to fix it. I've tried to correct it a million & one ways...
Code:
1061: Call to a possibly undefined method getChildByName through a reference with static type flash.display:DisplayObject.
I'm trying to target a button named 'mcTargetButton' (a SimpleButton) that's inside a movie clip called 'mcTargetParent' from a movie clip called 'mcCallFromThisClip'.
Both clips are on the main timeline. Note, I am using a document class... if I trace (this.parent) from 'mcCallFromThisClip' it prints the name of the document class.
[Code].....
how hard should it be to reach a button from a different movie clip?
View 1 Replies
Jun 1, 2010
i am using a movieclip who has two nested movieclips, the problem i am dealing is that when i try to get the width or height of the parent movieclip it always showing the values of the small nested movieclip, when i draw the movieclip it draw perfect but when i read this values shows that error, what can i do?
View 2 Replies
Dec 4, 2011
I want to apply actions to a movieClip nested inside a dynamicly attached movieClip, with the attachMovie method; it doesn't works when the movieClip is attached by a button:
1.when the swf movie loads with an attachMovie method the remove_btn clears the window_mc
[Code]....
View 9 Replies