Maintaining Event Behavior For Movie Clips Nested In Movie Clips
Is there any way to maintain a clip's event callbacks when said clip is nested in a parent clip that has its own definitions for those callbacks?
In other words, if clip B has a definition for .onPress and clip A has a definition for .onPress, is there anyway to maintain clip B's definition if it is nested in clip A?
I have tried doing it by making clips into movie clip subclasses but it doesn't work... but how do components work then?
FlashKit > Flash Help > Flash ActionScript
Posted on: 01-23-2006, 11:27 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Event Handlers Inside Nested Movie Clips...
I'm having an issue with my event handlers that I have on a movie clip nested in another movie clip. I have a mc on the main timeline here called "logos_section" that has a few behaviors. I have an mc called "bicyclelove" inside "logos_section" that I'd like to apply similar characteristics to please take a look at my code if you can. The code is on the MC themselves.
Right now the behavior is that when you roll over bicyclelove nothing happens but when you click anywhere on the logos_section mc it acts as if it was clicked on and goes to the right frame. I can't figure out why the mouseUp would respond and not the rollOver/rollOut.
Thanks.
Odd FLV Playback Behavior When In Movie Clips
I have a movie clip that I wish to show an FLV Playback component on frame 2. The actionscript is correct, but when I put the FLVPlayback component into my library, a red film icon appears at the top left of my movie, and the movie never fully initializes.
Any idea what's causing this?
Weird Behavior Of Dup Movie Clips In Game
Hello all, in this game I made there is a problem I can't figure out.
Check it out http://www.thedrummerswebsite.com/marsha.html
Sometimes when you play the game, the aliens coming from the top or the upper left corner will just appear at the lower left corner without walking down the movie. It only happens sometimes and thats what confuses me. I have had problems with depth issues before but when that happens the movie clip usually dissapears after a moment rather than appearing out of nowhere. Any ideas?
Weird Behavior When Resizing Movie Clips
Hello everybody,
Been trying for some days now to create a menu system in flash for a project of mine and I came across some issues that shouldn't be there...The goal is to have a menu where menu items resize when rolledover to reveal the actual choices of each menu item. So after a couple of days of thinking and trying, something really unexpected happened. I've created a component to act as the menuitem holder, which is composed of two dynamic text areas. The first is the title of the menuitem,which remains unchanged, and the second is the area where I want some html links to appear. The second is the area where I want it to be visible only when rolledover. So I thought that if by actionscript I set the height of the area to 0 when loaded, when rolled over I will set it to a higher value and it would seem that it rolls down from the menu title. Here's the funny part...it won't do it!! If I set the initial height to,let's say, 50px, then it will resize only up to that value nomatter what the set _height is. Can someone explain why this is happening? It's seems like a bug to me. Any help would be appreciated...Thanks!!
Weird Behavior With Flash Drag And Drop Movie Clips
I have a puzzle in Flash where the user drags letters in a word scramble to
form the word. The blocks where the letters go are movie clip instances and
the letters that get dragged are also movie clip instances. It all works
fine . .in fact I have done these in the past with no problems.
This time .. I have approximately 5 letters that are dragging BEHIND the
block instead of in front. I have confirmed that my letters and my block
instances are named correctly and I have confirmed that my action script is
also correctly named. I can find no problems .. but the letters (about 5
out of 80-90) are going behind the blocks while all the others work just
fine.
Have others had this problem? What did I do wrong?
Thanks!
--
Nancy Gill
Adobe Community Expert
BLOG: http://www.dmxwishes.com/blog.asp
Author: Dreamweaver 8 e-book for the DMX Zone
Co-Author: Dreamweaver MX: Instant Troubleshooter (August, 2003)
Technical Editor: DMX 2004: The Complete Reference, DMX 2004: A Beginner''s
Guide, Mastering Macromedia Contribute
Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced PHP Web Development
Nested Movie Clips Help
Flashkit member Garbage originally helped me with this menu system. Since then I've added a menu item and now it has developed a funky problem. I've been going over and over this thing for two days and I can't see why this is happening.
http://synap-sys.com/submenu.html
here's the problem: every combination of menu choices works fine until you try to go from an open 'service' menu to an open 'civic' menu. You click on 's' service menu appears, you click on 'c' and the service menu retracts like it should but the 'civic' menu never opens up, and it also disables all the other buttons. The 'civic' menu works fine until you try to choose it after the 'service'
Man, I can't figure it out.
Someone please help!
I've included the .fla if anybody wants to take a look at the Script (originally written by Garbage,thanks)
Thanks
Adam
Nested Movie Clips
FLASH 5:-
I have an MC nested within another MC.
MC1 is on the stage and MC2 is nested within MC1.
Now I have 2 buttons on stage that on (rollover) display both MC1 and MC2.
However, button 1 on (press) makes MC2 goto nextFrame whereas button 2 makes MC2 goto prevFrame. This works fine until I roll out.
After rolling out and rolling over either button again MC2 has gone back to the 1st frame.
Is there anyway I can make the nested MC not return to the 1st frame ?
MC2 contains 10 frames and each frame has a STOP(); action attached.
Thanks
Nested Movie Clips?
OK here's the deal I have a movie clip acting as a 3 state button (3 frames: over, off, down) nested on the second frame of a movie clip.
The idea is the outer movie clip shows something, when you rollover it it goes to the second frame that has the 3 state button, which should react to the mouse rollover and click
My code is in the root time line. "mac" is the parent MC on the root time line, "mm4v" is the child movie clip on the second frame.
The first part (green) works, the second par (red) dose not.
any ideas why?
mac.onRollOver = function() {
mac.gotoAndStop("over");
};
mac.mm4v.onRollOver = function() {
trace ("good")
mac.mm4v.gotoAndStop("over");
};
Nested Movie Clips And As3
hi wondered if someone could help me as this problemo is really slowing me down an dmy head hurts:|
in this instance what i want to do is load in an image into a movieclip that I have already created (by hand if u will ) and place don the stage. The main clip i have placed on the stage is called port and this is the code i am using to load it in.
function showMainImage(event:MouseEvent):void {
var mainLdr:Loader = new Loader();
mainLdr.load(new URLRequest("images/" + event.currentTarget.imagePath));
port.addChild(mainLdr);
port.mainLdr.x = 2
port.mainLdr.y = 2
bitmap.visible = true;
}
the bit that throws up and error seems to be the two lines that try and position the clip. I get the following as an error message:
TypeError: Error #1010: A term is undefined and has no properties.
at AS3_main_fla::MainTimeline/showMainImage()
its really got me stumped this one and in this respec tlife used to be much easier with as2:) but i know the benefits are there so i will stop whining.
can anyone help me please? a crate of belgian beer is in it if u live close by;)
reagards
ade
Nested Movie Clips
hi,
I recently downloaded a flash template that was built on AS2 and have been trying to figure out how it works for a couple of weeks now (excuse my ignorance when it comes to AS). I have a question about nested Movie Clips. The way the template is constructed invovles a massive amount of nested movie clips and a large number of instances of each movie clip. The way i understand it is that if an instance of a movie clip is put on the stage and given an instance name, any modifications to that movie clip should be unique to that instance. However when i modify the colour of any of the movie clips i select, it changes the colour of all other instances.
Am i missing something obvious here??
Thanks in advance for your help
Kind Regards
Damien
Nested Movie Clips
If you have a movie clip inside a movie clip, and if you test the scene, and it's fine, but when you test the whole movie, the nested movie clip doesn't animate... what's the problem? Thanks for any help.
Sincerely,
Bry
kiddopail@hotmail.com
Please Help - Nested Movie Clips
Im working on a uni project and have his a brick wall
The project is a prototype PDA made up of a host movie (host.swf) which loads other swf's in to display on the screen.
My problem is with my menu.swf
For example i include some code
Code:
//clock section starts
createEmptyMovieClip("clock_container",1);
container._x = 225;
container._y = 100;
clock_menu_btn.onPress = function() {
loadMovie("clock.swf", "clock_container");
_root.music_container._visible=false
_root.shopping_container._visible=false
};
//clock section ends
I want the button when clicked to hide any other open movie clips.
It works fine when opened as menu.swf but if its nested in host.swf it doesn't work.
Any ideas?
Thanks
Nested Movie Clips?
I don't know the correct name for this...but I'm using the 3d tutorial here for a pattern to make a cover flow gallery with dynamic images, the final project will pull the image location from an xml file...I know my navigation is working...
but the images aren't showing up, I hope this quote is enough to get an idea...
Quote:
for (i=0; i<=4; i++){
obj = theScene.createEmptyMovieClip("obj" + i, theScene.depth++);
var box = "obj" + i;
box.loadMovie("poster" + i + ".jpg");
obj.x = i * 225;
obj.z = 0;
obj.target = new Object();
obj.target.z = obj.z;
obj.onPress = selectObject;
obj.display = displayObject;
obj.type = 0;
obj.selNumber = objn++;
objectsInScene.push(obj);
trace(box);
trace("poster" + i + ".jpg");
}
Nested Movie Clips?
Hi All...
I have been working on an animation and I do not seem to be able to move on.
I am using AS2 and Flash 8.
What I would like to accomplish is have an animation I created of a number of balls vibrating and moving around, to play within a confined area. What I mean is that on my stage I have created a frame which I changed into a movie clip. Now what I would like to do is have my animation of the various balls stay within the frame. I tried to place the animations of the balls into the frame movie clips but no success. Any suggestions on how I could solve this dilemma?
Thanks
Brutium
Nested Movie Clips
If you have a movie clip inside a movie clip, and if you test the scene, and it's fine, but when you test the whole movie, the nested movie clip doesn't animate... what's the problem? Thanks for any help.
Sincerely,
Bry
kiddopail@hotmail.com
Strange Behavior - Creating, Loading Movie Clips Works Only For First Function Call
Hello,
I am reading an XML document and creating empty movie clips and attaching multiple instances of a movie clip from the library into each empty movie clip.
it works fine in the first loop and function call but after that, the movie clips register as being created, and attached but they aren't showing up.
Here's some of the code, in a nutshell:
[code]
function call_xml( start_cnt )
{
var xml_menu:String = 'gallery.xml';
menuXML = new XML();
menuXML.ignoreWhite=true;
menuXML.load( xml_menu );
menuXML.onLoad = parse_xml;
}
function parse_xml()
{
//---- create holder movie clips w/in the pc_movie_loader
//---------------------------------------------------------------------------
_root.pc_movie_loader.mc_holder_clip.unloadMovie();
_root.pc_movie_loader.createEmptyMovieClip( 'mc_holder_clip', 1 );
//----------------------------------------------------------------------------
for( var i:Number = 0; i < node_1.length; i++ )
{
subnode_1 = node_1.childNodes;
if( i >= this_start_cnt && i < this_end_cnt )
{
_root.pc_movie_loader.mc_holder_clip.createEmptyMovieClip( 'mc_demo_panel_' + i, i );
_root.attach_movie_clip('reg_demo_panel', _root.pc_movie_loader.mc_holder_clip['mc_demo_panel_' + i], '', row_x, row_y );
_root.print_clip_elements(_root.pc_movie_loader.mc_holder_clip);
row_cnt++;
row_y = row_y + (_root.pc_movie_loader.mc_holder_clip['mc_demo_panel_' + i]._height + 10);
if( row_cnt == 2)
{
row_x = 444;
row_y = 10;
row_cnt = 0;
}
}
}
}
and here's the print_clip_elements test function I'm using to print the contents of the movie clips:
function print_clip_elements( clip:Object )
{
for( var j in clip )
{
trace( "****** j:" + j + " : " + clip[j] );
}
}
and here's the attach_movie_clip test function I'm using to attach the movie clips from the library:
function attach_movie_clip( movie_clip:Object, level:Object, message_var:String, x_coords:Number, y_coords:Number )
{
level.attachMovie( movie_clip, movie_clip,10,{_x:x_coords,_y:y_coords});
}
[/code]
When I call the print clip elements the output is as follows for every function call:
===== START PRINT MOVIE CLIPS ============================
j:mc_demo_panel_4 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_4
===== END PRINT MOVIE CLIPS ============================
===== START PRINT MOVIE CLIPS ============================
j:mc_demo_panel_5 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_5
j:mc_demo_panel_4 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_4
===== END PRINT MOVIE CLIPS ============================
===== START PRINT MOVIE CLIPS ============================
j:mc_demo_panel_6 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_6
j:mc_demo_panel_5 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_5
j:mc_demo_panel_4 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_4
===== END PRINT MOVIE CLIPS ============================
===== START PRINT MOVIE CLIPS ============================
j:mc_demo_panel_7 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_7
j:mc_demo_panel_6 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_6
j:mc_demo_panel_5 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_5
j:mc_demo_panel_4 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_4
===== END PRINT MOVIE CLIPS ============================
it's registering that all the movie clips have been created and the mc_demo_panel library item has been attached.
Any ideas why the first function call works and everyone after that doesn't?
Thanks,
Clem C
Strange Behavior - Creating, Loading Movie Clips Works Only For First Function Call
Hello,
I am reading an XML document and creating empty movie clips and attaching multiple instances of a movie clip from the library into each empty movie clip.
it works fine in the first loop and function call but after that, the movie clips register as being created, and attached but they aren't showing up.
Here's some of the code, in a nutshell:
Code:
function call_xml( start_cnt )
{
var xml_menu:String = 'gallery.xml';
menuXML = new XML();
menuXML.ignoreWhite=true;
menuXML.load( xml_menu );
menuXML.onLoad = parse_xml;
}
function parse_xml()
{
//---- create holder movie clips w/in the pc_movie_loader
//---------------------------------------------------------------------------
_root.pc_movie_loader.mc_holder_clip.unloadMovie();
_root.pc_movie_loader.createEmptyMovieClip( 'mc_holder_clip', 1 );
//----------------------------------------------------------------------------
for( var i:Number = 0; i < node_1.length; i++ )
{
subnode_1 = node_1[i].childNodes;
if( i >= this_start_cnt && i < this_end_cnt )
{
_root.pc_movie_loader.mc_holder_clip.createEmptyMovieClip( 'mc_demo_panel_' + i, i );
_root.attach_movie_clip('reg_demo_panel', _root.pc_movie_loader.mc_holder_clip['mc_demo_panel_' + i], '', row_x, row_y );
_root.print_clip_elements(_root.pc_movie_loader.mc_holder_clip);
row_cnt++;
row_y = row_y + (_root.pc_movie_loader.mc_holder_clip['mc_demo_panel_' + i]._height + 10);
if( row_cnt == 2)
{
row_x = 444;
row_y = 10;
row_cnt = 0;
}
}
}
}
and here's the print_clip_elements test function I'm using to print the contents of the movie clips:
function print_clip_elements( clip:Object )
{
for( var j in clip )
{
trace( "****** j:" + j + " : " + clip[j] );
}
}
and here's the attach_movie_clip test function I'm using to attach the movie clips from the library:
function attach_movie_clip( movie_clip:Object, level:Object, message_var:String, x_coords:Number, y_coords:Number )
{
level.attachMovie( movie_clip, movie_clip,10,{_x:x_coords,_y:y_coords});
}
When I call the print clip elements the output is as follows for every function call:
===== START PRINT MOVIE CLIPS ============================
j:mc_demo_panel_4 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_pan el_4
===== END PRINT MOVIE CLIPS ============================
===== START PRINT MOVIE CLIPS ============================
j:mc_demo_panel_5 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_pan el_5
j:mc_demo_panel_4 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_pan el_4
===== END PRINT MOVIE CLIPS ============================
===== START PRINT MOVIE CLIPS ============================
j:mc_demo_panel_6 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_pan el_6
j:mc_demo_panel_5 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_pan el_5
j:mc_demo_panel_4 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_pan el_4
===== END PRINT MOVIE CLIPS ============================
===== START PRINT MOVIE CLIPS ============================
j:mc_demo_panel_7 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_pan el_7
j:mc_demo_panel_6 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_pan el_6
j:mc_demo_panel_5 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_pan el_5
j:mc_demo_panel_4 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_pan el_4
===== END PRINT MOVIE CLIPS ============================
it's registering that all the movie clips have been created and the mc_demo_panel library item has been attached.
Any ideas why the first function call works and everyone after that doesn't?
Thanks,
Clem C
Nested Movie Clips Coordinates
I have MC1 and MC2
MC2 is place inside MC1
I am having problems getting _root.mc1.mc2._x to respond correctly to the coordinate system for the main movie.
I'm not sure of the correlation.
Buttons Nested In Movie Clips
Hello, I need some help for a friend... We want to make buttons nested in a movieclip go to and play another frame/movieclip in on the main timeline. Do you target the instance on the main timeline? That is what i've been doing, it is not working.
I think the problem may be that she came to me last minute and i had only half hour to find the problem...
Any help would be great!
Nested Movie Clips/Buttons
This is hard to explain, but here goes...
On the main timeline, I have a movie clip. lets call
it "main". Inside that movie clip is another movie clip
let's call that one "clip2". Inside that movie clip
is a scroller movie clip. There is a button inside the scroller
that when you press it, I want to be able to call "clip 2"
and just have the playhead go to the next frame on "clip2"
I've attached a fla as an example (flash 5). I hope someone understands this and can help me.
Nested Dynamic Movie Clips
I'm loading movie clips dynamically into a movie.
What I would like to do is load sub-clips into previously loaded movie clips within my movie (ie: attach additional graphics to a graphic I loaded before). The reason I want sub-clips is that I'd like the sub-clips to update automatically as the original movie clip is updated, while maintaining their original offset.
This seems like it would be possible, and in fact, I can get it working with non-dynamic mcs.
Are there restrictions with dynamic clips that I am not aware of or is there another error in my code?
Thanks for your input,
sand858
Collisions From Nested Movie Clips
Dear all flash lovers,
I am in need of some help if possibel.
I have been playing with flash 8 and in the process of making a simple game.
but I have come across a problem with collisions that no one seems to have answered. well I have been looking all day and found nothing. I need 9 squares that move independently of each other, randomly. because of this |I have had to inbed all the variables into 1 movie clip. so that all i need is to copy that 1 movie clip 9 times without changing any code... so far so good, till I started setting up the collisions with the boundries and the other replicated squares.
Question:
I have a square(MC) that i need to detect when it collides with the boundries which are in the _root. The square is nested (inside a movie clip). and that movie clip is inside another. here is the simple code i am using to do this.
if (_root.b1.hitTest ( this._x, this._y, true) == true )
{
_parent.variables.COL1 = 1;
}
if (_root.b2.hitTest ( this._x, this._y, true) == true )
{
_parent.variables.COL1 = 2;
}
if (_root.b3.hitTest ( this._x, this._y, true) == true )
{
_parent.variables.COL1 = 3;
}
if (_root.b4.hitTest ( this._x, this._y, true) == true )
{
_parent.variables.COL1 = 4;
}
trace(_parent.variables.COL1);
but for some reason it will not play ball.
any help would be great as my mind is fried
kind regards
taz
Scrollbars Nested In Movie Clips[CS4] And AS3
I have developed a simple website for a college handup.
It has a main window and another window beside it, in which I have created a movie clip.
I want to use this movie clip as a window for a scrollbar.
I have nested my scroll bar within this window and it will not scroll.
I also keep getting this error:
TypeError: Error #1006: init is not a function.
at CiaraMADMT_fla::scrollwindow_6/frame1()
The scroll bar consists of one line of code:
sb.init(txt_mc, "easeOutBack",2,true,2);
I tried having the scrollbar on the main stage and not nested but it kept throwing out my other code completely.
I am starting to think that flash and AS3 secretly HATE me!
If anyone can help I would give them my firstborn
Duplicating Nested Movie Clips?
Is it possible to dupliacte a nested movie clip
I have a movie clip called myLoc and inside this is another movie clip called myObject and I wish to duplicate this.
I am using
duplicateMovieClip("_root.myLoc.myObject", "newObject", 1);
newObject._x=250;
newObject._y=200;
newObject.gotoAndPlay(2);
but it does not seem to work any ideas
Problem With Nested Movie Clips
Ok, I'm trying to write a class that draws a window which has multiple parts. I want it to draw a title bar (which it does) and I want to be able to drag then entire window around by pressing and holding on the title bar (which it does not do). Here is the relevant code from the class:
ActionScript Code:
private function DrawTitleBar(){
myTitle.removeTextField();
c = myContainer.getNextHighestDepth();
titleBar = myContainer.createEmptyMovieClip("myTitleBar",c);
titleBar.beginFill(titleBarFill,windowAlpha);
titleBar.lineStyle(borderSize, borderColor, windowAlpha);
titleBar.moveTo(Rect.left,Rect.top);
titleBar.lineTo(Rect.left,Rect.top+titleBarHeight);
titleBar.lineTo(Rect.right,Rect.top+titleBarHeight);
titleBar.lineTo(Rect.right,Rect.top);
titleBar.lineTo(Rect.left,Rect.top);
titleBar.endFill();
//
//Drag on the bar
titleBar.onPress=function(){
myContainer.startDrag();
}
myContainer is an empty movie clip I created from within the class like so:
ActionScript Code:
d = _root.getNextHighestDepth();
myContainer = _root.createEmptyMovieClip(windowTitle, d);
The following code works fine, except that it makes me drag the window no matter where I click on it:
ActionScript Code:
myContainer.onPress = function() {
myContainer.startDrag();
}
I can not get it to drag the entire window by simply clicking on the title bar. Why is that? It doesn't make any sense to me that this should not work. What am I doing wrong?
Help With Nested Movie Clips And Events
Hello,
I have several movie clips which are dynamically nested inside another movie clip using attachMovie. I am successful at loading these movie clips and I can manipulate them via actionscript with no problems. The problem comes on the events. None of them fire with any mouse activity (onPress, etc). The only event that fires is the onLoad event. Any suggestions as to why this might be happening? They are nested 2 deep... the second container is masked.
Thanks!
Nested Hit Areas (Movie Clips)
Hello again!
I have a lovely problem that I just can't seem to work out... Would appreciate it if one of you guys could help me out...
*** Scenario ***
I have an image with a hit area which when i hover over it, the mouse cursor changes to a magnifying glass...
On certain parts of the image [top/middle/bottom] I need to display closeups of whichever section the mouse is hovering over.
*** Problem ***
I have managed to create the main hit area which turns the cursor to a magnifying glass... I'm not sure how to add a hit area over the top of the MAIN hit area and still retain the magnifying glass cursor... Whenever you add the actionscript for a rollover on this movieclip it goes back to the hand - is there an easier way of nesting hit areas so to speak?
Cheers,
Luke.
Targeting Nested Movie Clips
I have a menu that attaches movie clips to an empty holder movie clip on the stage. Using this code:
Code:
this.button1.onRelease = function() {
var swapthedeck:String = "mc1";
_root.attachMovie(swapthedeck, "holder", 20, {_x:1, _Y:1});
enableAll();
this.gotoAndPlay("_clicked");
this.enabled = false;
}
In another area, I'm trying to find that movie clip that was loaded into holder for use in another script. I am currently using this:
Code:
this.control1.onRelease = function() {
control1.gotoAndPlay("_clicked");
var mcInstance:MovieClip = _root.getInstanceAtDepth(20);
trace (mcInstance);
}
However, when I trace the mcInstance, it returns "_level0.holder". This is the right name for the holder, but not the movie clip that was loaded inside of it. Does anybody know how to harvest the name of the movieclip that is present within holder? Any help is greatly appreciated. Thank you.
Rich
Pause ALL Nested Movie Clips?
Please, if anyone knows you can do this I need to know. I've asked this question here before but got 0 replies. Since then I've been batteling with code that sometimes works, sometimes not.
Is there any code or method to stop every nested movie clip currently on the stage?
Thanks
HitTestPoint With Nested Movie Clips?
Hi. I'm trying to make a top-down racing game, and I'm having some trouble with hitTestPoint.
I'm trying to detect a collision between each of the corners of the car (a movie clip) and the track wall (a long curvy shape inside a movie clip).
I have hitTestPoint working fine between the wall and the registration of the car movie clip (which is in the center), but I can't get it to work between the wall and a corner of the car.
I tried two things: First, I tried putting a movie clip at each corner inside the car movie clip and doing a hit test between the corner movie clip and the wall, but when I did that, it didn't detect a collision or do anything.
I also tried adding to the car.x and car.y in hitTestPoint to offset the spot it was checking, but it did that relative to the stage, not relative to the car movie clip like I need (because the car's rotation changes).
Does anyone have any idea how to do this? Is it just impossible to do hitTestPoint within nested movie clips? Am I just doing it all wrong? Any help is appreciated.
Reaching Nested Movie Clips
Hi, as you may guess I am new to actionscript. My question is how can I change the properties of a nested movie clip? When I run the following code the master_mc and tileShell_mc appear to be sharing the same _x and _y properties.
ActionScript Code:
attachMovie ("master_mc","master_mc",0);
master_mc.attachMovie("empty_mc","tileShell_mc",1);
master_mc.onEnterFrame = function(){
changeRotation();
}
master_mc.tileShell_mc.onEnterFrame = function(){
changePosition();
}
function changeRotation() {
if (Key.isDown(39)) {
this._rotation += 5;
}
if (Key.isDown(37)) {
this._rotation -= 5;
}
}
function changePosition() {
if (Key.isDown(39) and x_speed<10) {
x_speed = x_speed+.5;
}
if (Key.isDown(37) and x_speed>-10) {
x_speed = x_speed-.5;
}
if (Key.isDown(40) and y_speed<10) {
y_speed = y_speed+.5;
}
if (Key.isDown(38) and y_speed>-10) {
y_speed = y_speed-.5;
}
this._x += x_speed;
this._y += y_speed;
}
Nested Movie Clips Problem
Hi, I have got two instances of a shape called "drawWindowRightBuilding" and found a script that can randomly change the colours of the movie clip. The website I got this from wasn't extremelty helpful to beginners like myself though. Currently the code will swap the colours of the movieclip (both windows) at the same time. I want it to do this with each individual window instance to make it more realistic.
I have been looking at this code all afternoon and can't work out what to do next.
Any help?
Thanks
//-----------CODE---------------
this.createEmptyMovieClip("rbr1w1", 9);
rbr1w1.createEmptyMovieClip();
drawWindowRightBuilding(rbr1w1, 100,405,120);
//new Tween(rbr1w1, "_alpha", Soft.easeOut, 100, 0, 10, true);
rbr1w1.createEmptyMovieClip();
drawWindowRightBuilding(rbr1w1, 100, 425, 120);
//Code for switching lights off
// create an instance of the Color class named cCircle
// associated with movieclip circle_mc
rbr1w1.cCircle = new Color(rbr1w1);
// function to apply a random color from the colors array to the movieclip
// associated with color instance c
function changeToRandomColor(c:Color) {
//var randomColor:Number = colors[Math.floor(Math.random()*colors.length)]
rbr1w1.cCircle.setRGB(0xFBEC5D);
}
// assign a color instance, a default start color, and an interval to each light
for (var ilight:String in rbr1w1) {
// create a color instance for associated movieclip
rbr1w1["c"+ilight] = new Color(rbr1w1[ilight]);
// assign random color to movieclip at start
rbr1w1["c"+ilight].setRGB(colors[Math.floor(Math.random()*colors.length)]);
// set up the interval for each light
// the color instance (this["c"+ilight])is passed to changeToRandomColor as a parameter
setInterval(changeToRandomColor, 1000 + Math.random()*6000, this["c"+ilight]);
}
Accessing Nested Movie Clips
i've got a movie clip i export from my library using addChild() ... I'm curious... how do i access the nested movie clips within? here's my code:
Attach Code
var theNav:MovieClip; //nav movie clip
theNav = new myNav;
theNav.x = 150;
theNav.y = 250;
this.addChild(theNav);
OnRollOver With Nested Movie Clips
I'm having a hard time getting some nested movie clips to respond to an onRollOver event.
given:
_root.game_mc.gameVenueBtn_mc
game_mc will respond to onRollOver, but the gameVenueBtn_mc will not. If I change gameVenue_mc to a button, the hand cursor appears when it is over, but still no onRollOver event.
Can somebody please explain the simple rules about how nested movieClips identify the onRollOver?
Thanks for any help in advance!
Transitions Between Swf With Nested Movie Clips
in regard to voetsjoeba's tutorial http://www.nipi.pri.ee/tutoriaal/tutoriaal.html
I have a query, do the swf files which are called up (section 1, 2 etc) have to be on the main timeline, you see I have nested my transitions and animations into MCs and when I cam to run my main movie the swf starts and stays in the midpoint (no transition between them. I read a tutorial on here already which helped with nesting my buttons into a movie clip in my MAIN swf using _parent instead of _root but I need help
for instance lets say for the button for graffix.swf i have kept the code as
on (release) {
if (currMovie == undefined) {
currMovie = "graffix";
_parent.container.loadMovie("graffix.swf");
} else if (currMovie != "graffix) {
if (_parent.container._currentframe >= _parent.container.midframe) {
currMovie = "graffix";
_parent.container.play();
}
}
}
and in the actual graffix.swf for which i put the transition in an MC the code in the last frame is
container.loadMovie(_root.currMovie+".swf");
there seems to be a broken link somewhere there, I;ve tried everything from changing the container to _root.container with the buttons and adding the name of my MC to the code
please point me in the right direction ...
thank you
regards
johnny b
Nested Movie Clips With Events
I am nesting a button inside of a mc. The mc has an onRollOver and onRollOut event on it.
I would like the buttons nested inside the parent mc to have their functionality when the RollOver state is in action.
As of now it does the button remains inactive.
I can email you the file if you have time to help.
Many thanks if you can help out.
Tageting Nested Movie Clips
I am a AS3 newbie and am working on an animated cell phone text demo for my company's web site. I have three phones, each are a movie clip with a time line animation. The three phones are all inside of another movie clip where I animate their intro. I have a stop on the first frame of each of the three cell phones so that their screens are static as they fall into place. Their animations begin on the second frame of each of their respective time lines, and I would like the animations to begin when the phones are clicked. I'm not sure if these clips should be targeted from the main time line with the rest of the global script or if it should be on the time line of the nested MC. Even if I knew where to put it, I'm not really sure exactly what the script should be. Please help! My boss wanted this done last week!!!
Targeting Nested Movie Clips
The setup:
I have two rectangle movie clips named rectMC1 and rectMC2 in the library. In my AS their variables are _rectMC1 and _rectMC2. Within rectMC1 there is a nested movie clip with the instance name nestedRectMC1. Within rectMC2 there is a nested movie clip with the instance name nestedRectMC2.
The problem:
I am trying to check the 2 nested movie clips for collision but I am not sure how to target them in my AS. I have tried the following:
Code:
function checkCollision(event:MouseEvent):void
{
if(_rectMC1.nestedRectMC1.hitTestObject(_rectMC2.nestedRectMC2)
{
do this and that;
}
} // end function checkCollision
However, I am getting this error message:
TypeError: Error #1010: A term is undefined and has no properties.
Anyone know what's wrong?
Targeting Nested Movie Clips?
Hey everyone, I have a movie clip which is my global navigation, inside that movie I have several other movie clips for further control such as options, thumbnails etc. Well normally in as2 I would just use an _parent and target the nested clip. Not sure what I am doing wrong here but would appreciate some help.
Code:
import caurina.transitions.*;
// cant target the movie inside globalNav movie which is op1 even with like this.globalNav.op1 it doesnt work
globalNav.op1.addEventListener (MouseEvent.CLICK,minNav);
globalNav.op1.buttonMode = true;
// minimize window
function minNav (event:MouseEvent):void
{
Tweener.addTween (globalNav, { x:79, y:732, time:1});
}
Load Order Of Nested Movie Clips
I find it disturbing that load clip events for child MCs occur after the load event for parent MCs. I would expect that when a parent load event is fired, you would be guaranteed that all contained children are also loaded. Unless I am mistaken, this is not the case.
The inner/child MC is just a couple of items such as a text box and such. The load on the inner child works fine. This is where I define my properties, functions and events. The wrapper MC just encapsulates all of this and allows me to stick it all in the library. When I drop (reuse) an instance of the wrapper MC onto the stage and try to hook up to MY event handlers in the wrapper MC's load clip event, I find that the properties, functions and event definitions on the innter MC have not yet ben set up.
Anyways, I have a work around which seems a little cludgy to me. The enterFrame event DOES seem to wait until all child MCs are loaded. As such, initialization can be done the first time that event is entered as such:
onClipEvent(enterFrame){
if (this._initialized == undefined){
this._initialized = true;
obj.setOnChangeValue(_root.HandleIt);
}
}
Note that obj is the instance of the inner MC. setOnChangeValue sets my event handler (which is defined in the wrapper MC).
Does this seem like a strange approach to you? I don't really like the enterFrame approach, but I don't see another way due to the load order.
Thanks,
Nested Movie Clips, Dynamic Text, Help
I am developing a little site, and I have a menu on the root level of the movie, when you roll over a button, there is an action script to start up a movie clip called "menu_clips" , menu clips has a text box that tweens into place and a dynamic text box that changes for each menu item. the root level is all in frame 1 and I have menu_clips in its own layer with instance name "menu_clips" , it works fine with a dynamic text box in the clip "menu_clips" however I want to place the dynamic text box into a container movie clip called "text_box" or something like that, so I can move it around within "menu_clips" more easily. I am having some trouble getting this to work. With "menu clips" I placed an intance of "text_box" (which contains my dynamic text box, variable "menuTextBox") and named the instance "text_box", on the root level, I originally had an actionscript like this:
on (rollOver) {
if (menu_clips.menuTextBox==_root.about) {
stop ();
}else {
setProperty ("menu_clips", _visible, 1);
setProperty ("about_matt", _visible, 1);
about_matt.gotoAndPlay(1);
menu_clips.gotoAndPlay(12);
menu_clips.menuTextBox = _root.about;
}
}
this worked fine, however I can't really do much with a dynamic text box on its own, the new script which does not work looks like this:
on (rollOver) {
if (menu_clips.text_box.menuTextBox==_root.about) {
stop ();
}else {
setProperty ("menu_clips", _visible, 1);
setProperty ("about_matt", _visible, 1);
about_matt.gotoAndPlay(1);
menu_clips.text_box.menuTextBox = _root.about;
menu_clips.gotoAndPlay(12);
}
}
I have also tried just
"text_box.menuTextBox = _root.about;"
but I am having no luck with this one
Please help if you can, any suggestions would be very much appreciated. Thank you.
If you'd like to see the movie, you can check it out here
http://www.roznet.com/ and click on the new roznet preview link, keep in mind it's just a preview and will eventually be full of nice effects and content, but for now it's very basic
OnRollOver/onRelease And Nested Movie Clips
FYI: If you have a movie clip with a nested movie clip, and you try to put a rollover or some other event handler on both the parent movie clip and the nested movie clip, the parent clip event handlers will grab the event and don't pass it on.
I have a tree menu element that has a little folder icon and the folder name, clicking on the icon opens/closes the folder, clicking on the name acts like a hyperlink. The folder icon is a Movie Clip with an onRelease handler. Since the folder name is simply a TextField - which is not a MovieClip - it doesn't support onRollOver/onRelease. But if you put the onRelease event on the parent Movie Clip, you can't click the folder icon.
Well, I solved the problem by creating another Movie Clip for the TextField to live in. But I have a bad feeling that once I get up to 500+ folder icons I may have some performance problems.
ObQuestion: I suppose I could set up a mouse listener, but then won't I have to do a hit test?
Nested Movie Clips..Whats The Limit?
Does anyone know if there is a limit to nesting movieClips?
I am creating a tree graph that when someone wants to add a child node, that child node will be created inside the parent node. This way I can make a whole side of a tree dissapear by making the parent node dissapear. However, the graph may be a thousand nodes deep. Any suggestions. Also, if anyone knows of a pre-made tree graph that I can build on, let me know.
Thanks!
Controling Duplicate Nested Movie Clips
in my movie I have a movie clip that is nested about 4 layerys deep. this movie clips parent clip is duplicated dynamicly. I need to be able to control this clip. it works hard coded:
mcScroler.scrolerMCS.r1.c2.gotoAndPlay("on");
this will work fine but when I try to
so the way it works is movie clip rx gets duplicated based on mv and named as r1,r2,r3,etc... inside this clip are 13 clips named c1,c2,c3,etc... those are what I want to control
if I hard code it
mcScroler.scrolerMCS.r1.c2.gotoAndPlay("on");
it controls it. how ever as r1 and c1 are dynamicly genereated in the for loop bellow I have set rw and cl to be the generated names of the mc but it does nothing I have tried String(="r"+a), eval(="r"+a) tryed
mcScroler.scrolerMCS.r+a.c+j.gotoAndPlay("on");
totaly lost on how to make this work
hope this makes some sense
oh and tracing cl rw returns the corect name but it just does not target it when put in the mc stacking order
thanx
//amount of movies to be duplicated
mv=7
for (a=0; a<mv; a++) {
for (j=0; j<14; j++) {
var rw="r"+a
var cl="c"+j
trace("cl "+cl);
trace("rw "+rw);
mcScroler.scrolerMCS.rw.cl.gotoAndPlay("on");
}
}
Scene Switching In Nested Movie Clips
I am building a site with multiple levels. _level0 is the main navigation and contains a code to make a MC on _level4 not visible or visible depending on which section the audience is looking at. That MC ("SubNav") contains three buttons to change the scene on _level4. Unfortunately, those buttons are not working inside that MC. Is there no way to change the _root. scene from inside a MC?
Thanks
D
Targeting Scenes From Nested Movie Clips
I have a movie with two scenes. In the second scene I have a movie clip containing a button. I want that button to gotoAndStop on a frame in the scene 2 timeline. Is this possible? I can get to scene 1 using with(_root) but I cannot get to scene to.
Nested Movie Clips With Buttons Actions
This is a real serious problem...
On the stage is an Movie Clip with the following actions-
on (rollOver) {
_root.weMC.play();
}
weMC is a movie clip with a little animation in it. It's actions are-
onClipEvent (enterFrame) {
if (this.reverse) {
this.prevFrame();
}
}
on (rollOut) {
this.reverse = true;
}
These actions are regarding something else...
Now the problem is that inside this Movie Clip (weMC), at the last frame there are two Movie Clips with the following actions-
on(rollOver){
_root.subMUS.gotoAndPlay(2);
}
on(press){
_root.subP.gotoAndPlay(2);
}
When I test the movie, I take my mouse over the first Movie Clip and it works fine but when the animation of weMC is over(it has a stop action in it's last frame) I try to click on the two Movie Clips and they just do not respond!
Any idea what this is about?
Movie Clips Vs Graphic With Nested Images?
Can someone (or someones) tell me what is better in certain situations and the advatages and disadvantages of using a Movie Clip to illustrate a something like a walk cycle or eye blink vs the same thing with a Graphic with nested images?
I'm not really familiar with Graphics with nested images, so can you give me a little bit of quick info on how it works or a tutorial that would help me?
Thanks
|