ActionScript 3.0 :: Target A Movieclip Within A Movieclip?
Jul 30, 2010
Its day 3 of learning AS3 for me. I cant seem to target a movieclip within a movieclip. I code with all my actions on the first frame of the root timeline and would like to continue this practice. But when I target the clip from the root my function wont run.
Here is my example:
Code:
wheel_mc.spinBackward_mc.buttonMode = true;
wheel_mc.spinForward_mc.addEventListener(MouseEvent.CLICK, spinForward);
function spinForward(event:MouseEvent):void {
[code]....
Basically it wont gotoAndPlay("fadeIn") and I'm not sure why. So my question so I can move on in my AS3 learning is how to I target a movieclip with another movieclip, or is there another more proper way to do what I'm trying to achieve.
I'm doing a project that makes a movieclip draggable in different droptarget movieclip. When it is dragged in the 1st target an animation is triggered and so as the rest of the droptargets.Here's my initial code that does'nt work:
var profileholder:profileHolder=new profileHolder ;
inside of profileholder is another movieclip(infoBtn) that acts as a button.when the mouse is over profileholder i want to do something with infoBtn like:
//profOver is the over state of profileholder function profOver(e:Event) { e.target.infoBtn.alpha=1; }
this doesn't work and brings up this error:ReferenceError: Error #1069: Property infoBtn not found on flash.display.Loader and there is no default value. at main_fla::MainTimeline/profOver()
i also tried: function profOver(e:Event) { var item:profileHolder=e.target as profileHolder; item.infoBtn.alpha=1; }
and get this error:TypeError: Error #1009: Cannot access a property or method of a null object reference.
I have some buttons working great on my main timeline using this code on the actual timeline[code]...
So I know I need to make Revlon_mc into another movieclip (so I can do the actual animation inside this movie clip and move it easily around the main timeline) but I'm not what the code would be (something to do with parent perhaps??) and would I still keep the code on the main timeline or would it sit within the new moviclip just created?
I have some drop targets that work, but I also have a movie clip that can be turn on over the main timeline. All this clip is, is some low alpha colors for a viewing effect. Since it's above the drop target though it doesn't want to work. Is there a way to make it associate with the droptarget underneath, or a way to make the
I've been able to find how to load external .swf's into a target but how do I load a regular MovieClip from my Library? Can you do that with loadMovie?
i am making a drag drop game. i created a doc class for the dragged items . i want to make the hit test with some movie clips on the stage but inside the class they are not seen by there names. how to perform my hit test
this is my code,and target1_mc &target2_mc are movie clips on the stage
I have a video player that's control bar's x & y are over the top of the video. It is set to alpha 0, and when the user rolls over the video the control bar's alpha goes to 1 and becomes visible. I have a few even listeners and a function that makes this happen. My issue is that the buffer handle and the volume handle do not go to alpha 0, despite the fact that their parents do. The instance of "volumeHandle" is the child of "volumeSlider". "volumeSlider" does go to alpha 0, then to alpha 1 on rollover, but it's child "volumeHandle, is always visible. The same applies to the respective instances of the buffer bar.
I have tried volumeHandle.volumeSlider.alpha = 0; But that doesn't work. My guess is that the conflict lies in the linkage of the controls for the buffer and volume handles.
Can i target the second key frame of an empty movieclip which is created by actionscript.as for example:this.createEmptyMovieClip("target_mc",1);I want to write some script on the second keyframe on the target_mc movie clip. Is that possible.
I changed the question as its seems to be a problem with target not registering children mc/ or nested MovieClips.
var box:Box = new Box(); ground.push(box); levelPlane.addEventListener(MouseEvent.MOUSE_DOWN, onOver);
[Code]....
How Do i target the movieclips(BOX) inside of the main MovieClip(levelPlane)? imagine i have nested 10 boxes inside a MovieClip Called "levelPlane" i want to click on any of the boxes to add another Mc on the box i clicked x,y location.
I have been working with a very simple tutorial over at [URL], where you drag objects onto a target movieClip. My question is this, how do you target a movieClip inside a movie clip? What I have are 4 color squares that I want to drag and drop onto a pattern_mc. I put the target mc's with in the pattern_mc. In the tutorial the target mc's are not in a movie clip. I put my target mc's in a movieClip because I want to use the pattern_mc as a material.
I'm creating a site that allows drag and drop navigation. Here's the current preview:
[URL]
My goal is to allow the user to freely navigate the desktop and explore at their leisure, however, for the user who's a little more impatient I want to offer an option allowing them to click a button on the bottom menu and have the desktop slide directly from the movieclip's current XY coordinates (whatever they are at the time), to a designated XY, and center on that specific section, easing into place.
I've got placeholder buttons, and placeholders for the desired targets, but I can't wrap my mind around the code needed to do it, nor have I found any examples that use the same technique with AS3.
How to target the MovieClip in the listener of its tween ? I have an Array of MovieClip and each one have its own Tween. Each Tween have its own Listener. I want to target the MovieClip in the listener. I search in many forums and tutorials and I don't find anything convincing.
Is there any way to get the name of the MovieClip that a class extends?Lets say I have an MC on stage called boxMC exported for AS using a class box which extends MovieClip.If I trace (this) within my class I will get the name of the class, if I trace (parent) I will get the name of the main MovieClip that boxMC sits within. So how can I target boxMC?Basically I want to be able to return the name of the MovieClip that the class is extending
Code: Error #1034: Type Coercion failed: cannot convert movieclip1 to MovieClip. My goal is to have the dropTarget.parent.name turned into a movieclip so I can use properties on it. There is a movieclip that I want to drop on the Target, and I can use "this" for source, the movieclip that I'm dragging, but when I want to have properties on the destination, when I want to convert the String to MovieClip, I get #1034 And I don't know what is it that I'm doing wrong...
I've been trying for ages to find out how to do this exactly, but haven't had much luck, I'm trying to build a version of my portfolio site using Flash and Papervision, however, I'm having a little trouble coming up with more sophisticated interaction aside from assigning click events to individual objects.
Say I make a MovieAssetMaterial, and inside that material, I place another movieClip.
How do I target that nested movieClip so I can get it to do something? Is it even possible? From what I've researched I need to be using an "InteractiveSceneManager" but I can't find any references on how exactly to implement one.
I'm creating a site that allows drag and drop navigation.
Here's the current preview: [URL]
My goal is to allow the user to freely navigate the desktop and explore at their leisure, however, for the user who's a little more impatient I want to offer an option allowing them to click a button on the bottom menu and have the desktop slide directly from the movieclip's current XY coordinates (whatever they are at the time), to a designated XY, and center on that specific section, easing into place.
I've got placeholder buttons, and placeholders for the desired targets, but I can't wrap my mind around the code needed to do it, nor have I found any examples that use the same technique with AS3.
I am trying to build a menu, that loads external swf to target movie clip, in the code below it works if I remove the line target removeChild, but then if a press the other button, just put it on top, so my actual problem is that if I don't have anything loaded in target, this code doesn't work because it can remove child?
menu.btn_avanti.addEventListener(MouseEvent.MOUSE_DOWN, goseccion); menu.btn_professors.addEventListener(MouseEvent.MOUSE_DOWN, gofotos); function goseccion(Event:MouseEvent):void{ var main:Loader = new Loader(); main.load(new URLRequest("seccion_basica.swf")); target.removeChildAt(0); target.addChild(main); [Code] .....
I have several buttons on an externally loaded swf that work fine but I'd like to clean up the code if possible. Is there an better way to target the mc other than using multiple _parents?
Code: on (rollOver) { _parent._parent._parent._parent._parent._parent._parent.expression.gotoAndStop (2); } on (rollOut) { _parent._parent._parent._parent._parent._parent._parent.expression.gotoAndStop (1); }
The thing is I am not exactly sure if this mc is going to remain an external swf or if it will eventually stand alone, which is why I haven't targeted the root at its level. I'd like it to work either way if possible.
I'm stuck with trying to target a movieclip dynamically from a loop. I'm using the square brackket syntax but I can't figure out why it's not working. Here's what I'm trying to do: Code: this.t1.t1._alpha=20; And here's how I'm trying to do it: Code: this["t"+1+".t"+1]._alpha= 20;
I'm trying to target a .swf that I loaded into a movie clip (mc_container) but it seems like I'm missing something. Can you take a look and see where I went wrong?
Code: mc_container.loadMovie("mc_photoSwap.swf"); //homepage Animation Swap Images function photoSwapAni(){ switch(random(3)){
[Code]...
Also I see I'm going to have an issue with the random part because it could call the same animation twice or more times in a row. Should I ad some sort of if statement or is there a better way to do this random part of the code?
is it possible to change the target level of a MovieClip? So I have two instances of the same MovieClip, both on level0.[code]Basically, now btn2 will disappear, and btn1 will remain visible.
I have 9 btns and one target to load submenus. The target has to close first and them load the selected one. Actually the target goes up and when it reaches y=x it loads the selected one.
I am wondering why the AS3 movieClip target path are soo complicated? I'm loading a simple external swf that contain a movieClip that I want to play with. But I can't find the proper syntaxe to call this movieClip..
var swfLoader:Loader = new Loader(); holderSWF.addChild(swfLoader); var externalSWF:URLRequest=new URLRequest("externalFile.swf"); swfLoader.contentLoaderInfo.addEventListener(Event .COMPLETE, loadProdComplete); swfLoader.load(externalSWF);