Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








How To Target Child Clip Using This[]


I know how to target a clip directly using
ActionScript Code:
this["menuClip_Dr" + i]._y

But what about targeting a child clip in that clip:


ActionScript Code:
trace (this["menuClip_Dr" + k + "." + "childClip_" + i]._y);

The above reference to childClip is not working.




ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 02-27-2007, 04:11 PM


View Complete Forum Thread with Replies

Sponsored Links:

Target MC Child
On the main timeline I have an MC parent and inside it, MC child (planets) which are moving along the path (guide layer)... there is a button (on the main timeline) which when pressed sets the Alpha Property of the MC child to 50% ... the planets are still moving with their Alpha set to 50%...

here is the completed .SWF file - please take a look at:

http://www.geocities.com/decschultz/ispit.html


thanks
[Edited by Dario Šuveljak on 02-22-2002 at 04:21 AM]

View Replies !    View Related
How Do You Target A Container's Child?
ActionScript Code:
function one():void
{
    var container1:Sprite = new Sprite();
    container1.name = "container1";
    addChild(container1);
   
    var child1:Shape = new Shape();
    child1.name = "child1";
    container1.addChild(child1);
}

one();

trace(getChildByName("container1").getChildByName("child1").name);

The last line is what throws an error. In AS2.0, you would simply write container1.child1._x or container1[child1]._x but that of course doesn't work any more. I'd tried getChildByName("container1")[child1].x as well, but it doesn't work either. How do you target the child?

View Replies !    View Related
How Do I Reference/Target The Child Of An EmptyMovieClip Using An Array?
Code:
for (var menuItemNumber = 1; menuItemNumber<totalMenuItems; menuItemNumber++) {
_parent.createEmptyMovieClip("menuItem_"+menuItemNumber, _parent.getNextHighestDepth());
_parent["menuItem_"+menuItemNumber].createTextField("itemText_"+menuItemNumber, _parent.getNextHighestDepth);
_parent["menuItem_"+menuItemNumber]["itemText_"+menuItemNumber].text = "Test";
}

The above code in red does not work.

Does anyone know the proper notation that will allow me to reference/target the .text attribute of any of the "itemText_"+menuItemNumber instances?

View Replies !    View Related
Target Path For Loading Ext Swf From Child Swf To Parent Swf
I am trying this for the first time and have just spent 8 hrs straight using many diff approaches...nothing works. Please help.

I have a main movie timeline that loads other ext swfs into itself. I will call it main.swf. This is done with frame actions and works fine. These ext swfs are an intro to the website. I have also created an autonomous menubar movie... menu.swf that is an additional external swf that loads into main.swf perfectly in the next to the last frame. It is on level 12. The last frame for main.swf has a stop action. I have put the menu in a separate movie so it can sit above everything else and be visible no matter what movies are loaded from it into the parent swf below.

Within menu.swf there are buttons...each button is to load a diff ext swf into an invisible mc called empty_mc which resides on the top layer of the timeline in main.swf. So there is a parent file and a child file. The child file, menu.swf needs a correct path from a button to place a swf file into empty_mc residing in the main movie.

I have tried...

on (release) {
loadMovie("essays.swf", "_parent.empty_mc");
}

If loadmovienum is the way to go, how do I tell it to go to an empty mc on a particular level?

Either loadmovie or loadmovienum is the answer...but cannot get this to work...have tried a myriad of solutions I found searching online...nothing works.
Please help if you can...I must get this project done and I am physically sick at this point.

Thank You

View Replies !    View Related
Dynamic Photo Gallery / Target Child Mcs
hi all -

i'm trying to build a dynamic photo gallery that:

1) loads data from an xml file

i've got this code working somewhat:


Code:
// Create XML Object
myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.onLoad = function(success) {

// initialize variables
numimages = this.firstChild.childNodes.length;
spacingX = 90; // X spacing between each thumbnail - width of each thumbnail = 80
spacingY = 90;// Y spacing between each thumbnial - height of each thumb = 80
countX = 0;// use this counter to count how many across
countY = 0;// use this counter to count how many rows
countSet = 0;// use this to count how many sets total given a total # of thumbs
cCount = 3; // this sets how many thumbs across
rCount = 3; // this sets number of thumbs down

// loop thru each xml entry and generate, position, and link up thumbnails
for (i=0; i<numimages; i++) {

this.picHolder = this.firstChild.childNodes[i];
this.thumbHolder = _root.thumbnails.createEmptyMovieClip("thumbnail"+i,i);

if ((i % (rCount * cCount) == 0) & (i > 0)){
countSet++;
countY = 0;
}

// Reset the xcount every cCount. Increment ycount every rCount. Increment xCount every time.
if (i % cCount == 0) {
countX = (countSet * spacingX) * 0;
countY++;
} else {
countX++;
}

// Offset the thumbs
if (i > 0) {
this.thumbHolder._x = (countSet * (spacingX * cCount)) + (countX * spacingX);
this.thumbHolder._y = ((countY-1) * spacingY);
}

this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 100);
this.thumbLoader.loadMovie(this.picHolder.attributes.thmb,100);
this.thumbHolder.title = this.picHolder.attributes.title;
this.thumbHolder.main = this.picHolder.attributes.main;
//this.thumbHolder = _root;

// NEED TO FLESH THIS OUT
// create new movieclips and attach each JPG in set to new mcs.
this.mainHolder = _root.images.createEmptyMovieClip("main_image"+i,i);
this.mainLoader = this.mainHolder.createEmptyMovieClip("main_image",100);
this.mainLoader.loadMovie(this.thumbHolder.main,100);
//trace(this.mainLoader);

// load the first pic to the stage when the page first loads
if (i==0) {
startLoading(this.thumbHolder.main);
//startLoading(this.thumbHolder.main);
}

// event handlers for each thumbnail
this.thumbHolder.onRollOver = function() {
this._alpha = varAlpha;
trace(this);
}

this.thumbHolder.onRollOut = function() {
this._alpha = 100;
}

this.thumbHolder.onRelease = function() {
_root.targetImg= this.main;// set the img to load
_root.loader.onEnterFrame = switchImgs;// call function that fades out existing main img and fades in new
};
}
};

myPhoto.load(myFile);// load xml file
To swap out the images onRelease of each thumbnail, I've got this:


Code:
function switchImgs(targetImg) {
if (this._alpha > 0) {
this._alpha += -10;
} else {
startLoading(_root.targetImg);
this.onEnterFrame = null;
}
}

function startLoading(whichImage) {
loader.loadMovie(whichImage, 1000);
_root.onEnterFrame = function() {
infoLoaded = loader.getBytesLoaded();
infoTotal = loader.getBytesTotal();
percentage = Math.floor(infoLoaded/infoTotal*100);
// trace(percentage);
// infoField.text = percentage+"%";
if (percentage >= 100) {
delete this.onEnterFrame;
// infoField._visible = false;
fadeInLoader();
}
}
}
This is breaking down at a couple of points.

1) Since the images are being loaded dynamically, and they might be kind of big, seems like they don't load in time. I click on thumbs and they just crap out randomly. That's where I've started going w/ the "// NEED TO FLESH THIS OUT" approach of loading the external images once to a movie clip on the stage, and then swapping back and forth between those.

2) But then #1 above would make it nice if there was a loader that indicated how much of each main image is loaded, or better yet, to load each main image sequentially. Meaning, only load img2 if img1 is finished, etc...

Here's where I'm stuck and need some help:

A) I can't even target the thumbnails themselves. I tried everything: _level0.thumbnails.thumbnail0 (this is what is returned when I trace during the loop), _root.thumbnails, etc, etc. How do I target each specific thumbnail in the above code?

B) Since my routine loads the images during a loop of the xml nodes, I can't stop the loop until each main image is done loading. (nor do i want to since that would be weird). Instead I'd like to push the files into an array outside the xml loop, then kick off a process to load each image in the array sequentially, and only after each is finished. Any ideas on best ways to do this?

Thank you!!!

View Replies !    View Related
Duplicate Child Movies, How Do Specify Target Path
I have a parent movieClip (ie. dupMC) which I'm using duplicateMovieClip to create child movie clips. Then I'm dragging the duplicate child movieClips (ie. dupMC1) to a position on the stage, on the onRelease event a custom-built popop is postioned on the stage, from this popup you have a few options that you can select that then takes you to specified frame in the duplicate child movie clip.

_root.(duplicate movieClip).gotoAndStop(2);

That's my problem how do I specify a target path for child movie clips. I've tried setting a global variable of the child duplicated movieClip after dragging it:

_global.duplicateMCName = this._name; //dupMC1

And then using the variable in target path:

_root.duplicateMCName.gotoAndStop(2);

I'm was expecting the variable to place value into the path and then take it to the correct frame of the duplicated movieClip, like this:

_root.dupMC1.gotoAndStop(2);

But thats not happening and I could use a little help. Thanks!

View Replies !    View Related
Controling An Instance In A Parent Clip From A Child Clip? ANY Help Appreciated.
I'm sure this is simple, but I'm stuck.

I have an swf file called "base.swf", in which is an instance called "nav" which I need to move around _x and _y. "base.swf" loads a child called "navbuttons.swf". I need to use a button in "navbuttons.swf" to reach back to the parent "base.swf" and interact with the "nav" instance.

I tried the following on the button in "navbuttons.swf";


Code:
on(release){
_parent.nav.xpos=670;
_parent.nav.ypos=375;
}
I was thinking that since base.swf loads navbuttons.swf that the _parent part on the button would get me back to the parent, and the .nav part into the instance I want to control... but it's not working. I tried _root instead of parent with no luck.

I'm sure this is simple, can anyone point me in the right direction?

View Replies !    View Related
Attaching Clip To Loaded Child Of Parent Clip
Hi,

Is it possible to attach a clip, to a child clip of a parent, where the child clip was loaded in?? because it doesn't seem to be possible.

thanks

phil.

View Replies !    View Related
Assign Actions To Both Parent Clip And Child Clip?
Hello, i need to find a way to add actions to both a parent and child clip.
I ultimately need the entire nav to zoom in when rolled over, and the clips inside the nav have an onRelease function assigned. Any suggestions?

View Replies !    View Related
Load Movie Clip -> Update Child Clip
Ok, I'm not sure if this is possible, but I assume it is. So I load a movie clip in , we'll tall it "parent_clip" and it's getting loaded into a clip with the same name, so _root.parent_clip. In the loaded parent_clip there is a movie clip called "child_clip". Once it is loaded the child_clip is obviously still there, but it is no longer named child_clip. How do I access it?

Or am I just missing something all together. Thanks for the help.

View Replies !    View Related
Have Bright Colors Of A Child Clip "poke Through" A Darkened Parent Clip
I am not talking about masks, but was wondering if there is any way to restore, or brighten a child clip (without muddying the colors) that is inside a parent clip that has had its brightness turned down with a colorMatrixFilter?

Let's pretend:

darkBox_mc
lightBulb_mc

I put the lightBulb_mc inside the darkBox_mc, and set the box (and all of it's contents) dark by using a colorMatrixFilter, either adjusting the scale values of RGB, or the offset (still not sure how they differ).

So the lighbulb, when off, appears dark because the parent clip had its colors darkened.

Then, i would like the lightbulb to appear to turn on, essentially restoring the color value (or amplifying beyond its initial colorMatrixFilter) to its bright, natural state.


I guess the same effect I am going for is say I make a parent clip alpha 0, or.1 or something real low. Can i go through the child clips inside the near invisible parent, and make them appear normal again? Still keeping them inside the clip? Perhaps offset the alpha by overshooting the 0-1 range? alpha 3.5?

I could have sworn this was possible with some method. Convolution maybe?

View Replies !    View Related
Targetclip.movie Clip, What If The Target Clip Is An External .swf
I have a main.swf that loads a menu onto layer 2 as an external .swf.

when a button is pressed on the menu it loads another external .swf file (item1.swf) onto layer 1 so that the menu is infront of it.

when another button is pressed on menu.swf I want another external .swf (item2.swf) to load onto the same layer as the
first(item1.swf).

The thing is if I use loadmovie("item2.swf",1);
the item1.swf movies disappears immediately.

I have used targetclip.loadmovie, but can't get the target clip value. using this.loadmovie, or _root.movie works, but
doesnt leave the menu.

do I need to set up an empty "dummy" movie clip to use as the target to have movies load into that ?

hope that makes sense. Thanks in advance.

View Replies !    View Related
UnloadMovie From Child Clip
Hi,
I have a .swf that is loaded into a another .swf mc.
Can i close the child clip from inside itself.

Or do i have to close it from the parent swf?

View Replies !    View Related
Control Parent Clip From Child?
I have a child clip -- "base"
and a parent clip -- "form"

I want "base" (which is on "form"s frame 90) to tell form to go to frame 46.

How do I do this?

~DW~

View Replies !    View Related
Urgent Help Cant StartDrag In Child Clip
Okay> I have a movie, that loads another movie. the movie that is loaded has some drag commands that target within the same movie (not in the parent). How come this movie works when its on its own... but not at all when its loaded into the parent? help!
this is for my project due tomorrow. lol.
here is the code inside the movie that was loaded (attached to a button inside a movieclip)

here is the site im working on (if it helps) this is for the portfolio page which is loaded into the movie.

http://www.reactiongrafix.com/zen

as i say.. it works fine on its own. (like here)
http://www.reactiongrafix.com/zen/portfolio.swf


i get a pointer when i mouseover them.. but.. cant drag


Code:
on(press){
startDrag ("/dragHarry", true); //start da dragging
}

on(release){
stopDrag (); //stop da draging already!
if (this.hitTest(_root.target)) {
_root.drop_mc.gotoAndPlay("start");//play the clip
this._x = 57 ; // put it back
this._y = 145 ;
_root.gotoAndStop("harryPothead"); //lets play the target on the root timeline
}else{
this._x = 57; //put it back
this._y = 145;
}
}




-=-=-=-=-=-=-=-=-=-=-=-
Jon Thorpe
The ActionScript Newbie}

nicr0s@hotmail.com

View Replies !    View Related
Accessing A Child Movie Clip
This code doesn't work. The movie clip instance "start" is nested in a movie clip called "bridal_navigation".

_root.start.onRollOver=function(){
black=new Color;
black.setRGB(0x000000);
}
_root.start.onRollOut=function(){
teal=new Color;
teal.setRGB(Ox33CCCC);
}

View Replies !    View Related
Targeting A Child Movie Clip
Hi,

i have a parent_mc and a child_mc within parent_mc.

Now the parent_mc has 10 frames and the child_mc appears only on frame 10 of parent_mc. Also there is a stop action on this frame.


The MAINTIMELINE has an actions layer and parent_mc on stage.
Now when i try to target child_mc from the maintimeline using ...



Code:
parent_mc.child_mc.onRelease=function(){
trace("hello");
}



it does NOT work. I have seen that it only works if i make child_mc appear on the FIRST frame of parent_mc and carry on to the 10th, not if its only on the 10th frame...

does any why know why this is so?

cheers

View Replies !    View Related
For Each Child In XML - Create Movie Clip
i am currently working on my portfolio, and one of the main things i want to do is load my images and swfs from xml.

at the minute i am just trying to load the right number of containers for the number of files in the xml.

i understand the logic of what needs to happen, but am unsure of a few coding snippets.
i think once i load in my xml file it will be something like

for each var item in xmlData.image //image being the xml element
{
clip = new movieclip()
}

i'm not sure if there needs to be a counter so it goes throgh and counts and then displays them, at the moment i just want to work on that, and maybe get a gap between each one so i can see them loading in.

i'm going to keep looking at it but if anybody can help me out with an example or sample code that would be great

thanks
Dan

View Replies !    View Related
Reference Child Clip From Parent
I'm using actionscript 2.

I have a main movie clip. In that movie clip I have 2 children movie clips. I want the 2 children clips to be able to control each other upon clicking buttons.

This code has been placed in the main movie clip:

home.map_btn.onPress = function ()
{
loadMovie("http://apsleycottage.com.au/flash/town_location.swf", movie_holder_mc);
};

The map_btn is located in a child swf called home. The home swf is dynamically called into the place holder called left_movie_holder_mc which is located within the main clip.

I want the main movie to register a click of that map_btn and replace a the movie currently in the movie_holder_mc with a new one called town_location.

What I have done does not work and I am not sure if I have referenced the the button properly from the main movie. I would appreciate any help.

The temporary page is located at:
http://apsleycottage.com.au/Apsley_Cottage3.html

Cheers

Crossy

View Replies !    View Related
Getting ALL Child Names From A Movie Clip?
I have about 200 movie clips within a parent container that I would like store in an array -- without having to type out all 200 instance names into the array build. Is there a function that would allow me to extract and store all child names so I can just use that variable to build the array?

Thanks!!

View Replies !    View Related
Loading .swf Into Child Movie Clip
Trying to get an exteranal .swf to load into the child clip of a Mc that slides an _x axis.

1. I am going from root time line to a clip called rooms.
2. In the rooms MC there are 5 Mcs horizantally aligned on different layers.
3. I experimented with the idea that I could create a blank Mc and load and exteral .swf into it's eaxct location within the Rooms MC.
4. I am using the following in my 1 st frame: loadMovieNum("kitchen.swf","load");

5. of coarse This is loading the external kitchen.swf into the child clip instance named load right?


help.

Thanks in advance

View Replies !    View Related
Problem W/child And Parent Clip
Hello All,

I am having a problem controlling a child movie clip from the parent's timeline. I have all the scripting taking place in frame one of the parent and I want to make the child play with the following syntax:

ActionScript Code:
_root.projMas1.pd_f5_1.onRollOver = function() {
    _root.projMas1.projMot_2.Play();
};
Again, this syntax is in frame 1 of the parent movie clip and the button instance "pd_f5_1" is in frame 10.

I went with absolute paths because I didn't see the instance name of the button "pd_f5_1" in the target popup dialog box when the Relative raido button was enabled.

The only way I could make things work is if I envoked the actions on the button instance itself and not the parent timeline.

Can I not control the child from the parent timeline in this way...I wanted to keep all the code in the frist frame...do I have to move the code to the button instance?

Sincerely,

(jw.)

View Replies !    View Related
Targeting A Child Movie Clip:
I have a movie clip on the main timeline calledbg_graphics, I want to target a movie clip within that movieclip called bg1_mc. to gotoAndPlay frame 2.

if anyone can help me out with this code that would be great, but wait theres more.

The bg_graphics clip goes to a random frame within that movieclip, there are 3 frames. 1st has bg1_mc, 2nd has bg2_mc, and 3rd has bg3_mc. How could i determine which file to gotoAndPlay frame 2 in bg_graphics when i don't know exactly which frame its going to be on, let alone target a movie clip within a movie clip.

I used this code to generate the random frame if that is of any use to anyone who is willing to reply.

function randomBg() {
//generate random BG based on random frames within the MC
randFrame = random(3)+1;
bg_graphics.gotoAndStop(randFrame);
}

Can anyone help??? that would be great.

View Replies !    View Related
Targeting A Child Movie Clip:
I have a movie clip on the main timeline calledbg_graphics, I want to target a movie clip within that movieclip called bg1_mc. to gotoAndPlay frame 2.

if anyone can help me out with this code that would be great, but wait theres more.

The bg_graphics clip goes to a random frame within that movieclip, there are 3 frames. 1st has bg1_mc, 2nd has bg2_mc, and 3rd has bg3_mc. How could i determine which file to gotoAndPlay frame 2 in bg_graphics when i don't know exactly which frame its going to be on, let alone target a movie clip within a movie clip.

I used this code to generate the random frame if that is of any use to anyone who is willing to reply.

function randomBg() {
//generate random BG based on random frames within the MC
randFrame = random(3)+1;
bg_graphics.gotoAndStop(randFrame);
}

Can anyone help??? that would be great.

View Replies !    View Related
Setting Property In A Child Clip
via "Attachmovie"

my script has created these 3 levels ClipA.ClipB.ClipC

Clip C has a dynamic text box

When the movie loads...
ClipA creates multiple ClipB's and then assignes each with a different color
myColor = new Color(boxname); //boxname = new instance name
myColor.setRGB(0xAB12B8);

When the mouse hovers over a ClipB it attaches a ClipC which automatically becomes the same color as it's parent, which is good, except the Text in ClipC becomes the same color and therefore invisible.

I've tried using multiple methods, and MANY different places to drop the scipt in order to change text in ClipC


It seems once a new color has been invoked in ClipB, ClipC not only takes it but it can no longer be separated.???

By the by If I do not change the color of ClipB in the script, I can change ClipC;s colors


Is it a lost cause? Need I do this manually?

thx in advance


Ghandigu

View Replies !    View Related
AttachMovie() Child Clip Targeting
Thanks for taking the time to read this. Here's my problem: I have a clip, to which I am using attachMovie to attach other clips to the end of it, making one really long strip... no problem with that. Inside each of the clips are other movie clips that are named. I want to be able to get the _x values of the clips inside the clips that were attached. When I try to target them with something like this: baseMovieClip.attachedClip.MovieInsideAttached._x --- it returns a value of 0. When I attach a trace() command inside an onClipEvent(enterFrame) and trace the ._x of the clip inside the attached movie clip, it returns a value that is based on 0, and not the value of the width of the entire attachmovie then the value of _x for the clip inside. Does anyone know if it's possible to get the coordinates and properties of movieclips that reside inside attached movie clips? Any advice or suggestions are greatly appreciated.

View Replies !    View Related
Load And Position A Child Movie Clip
Hi all!

I am currently making a mini-game using Flash.
Well, I got a silly question, just wondering if anyone can take some time to answer me =P

In my game, when the player click a button, I loads a child movie clip into the current movie clip, at level1
and want to position this child movie clip at a specified location.
I used the following script, attached to a button, to do the task.

on (release) {
loadMovieNum ("childMovie.swf", 1);
setProperty ("_level1/", _x, "300");
setProperty ("_level1/", _y, "280");
}

But when I test the game, as I click the button, the movie loaded and position at the (300, 280) coordinate, and immediately it re-position to (0, 0) again.
Everytime I clicked that button, the childMovie go to (300, 280) and then back to (0, 0) again...
Alternatively, I use the following scripts instead

on (press) {
loadMovieNum ("childMovie.swf", 1);
}
on (release) {
setProperty ("_level1/", _x, "300");
setProperty ("_level1/", _y, "280");
}
The output seems normal and the childMovie doesn't re-position. But when I keep holding down the mouse button, the childMovie stay at (0, 0) and go to (300, 280) as I release the button. This's not wat I expect...

Well, the only thing I want to do is to load a movie at (300, 280) everytime I click the button...
Can anyone give me some suggestion?

Thanks in advance.

View Replies !    View Related
Is It Possible To Toggle The Quality Of A Child Movie Clip Only?
hi,

is it possible to toggle the quality from a childmovie clip from high quality to fast quality while the childmovie clip is running? The quality change should only affect that specific child movie clip.

and if it's possible, how would the action look like?

thanks in advance

xant

View Replies !    View Related
How To Call A Function Defined In A Child Clip
I've got simple problem - I want to call a function which is defined inside a child movie clip, but I can't
I've attached simple movie as an example.
When I'm in a child movie and I'm calling function defined in a parent movie everything is ok, but another way around isn't.
Can anyone help?

Adam

View Replies !    View Related
Problem With Child Clips In Main Clip
I have a main clip with a series of child clips being imported. The clips advance by user action (mouse click, keyboard stroke, button click in the main clip). Some of the child clips also stop and restart using the same method (except no movie button click). I'm running into problems with the advancement not working properly, depending on which method is used. I'm building this in Flash MX, in case any known bugs are the cause.

-buttons within the Main clip operate properly

-mouse click transitions between child clips properly, but skips over stops and starts built within the child clips. Instead of progressing within the movie, it jumps to the next unload/load sequence. The stops/starts work fine when the child clips are run by themselves. The problem is only when they're loaded into the main clip

-keyboard stroke properly operates the stops and starts within the child, but instead of progressing to the next movie in sequence, it restarts the current child clip. another quick click will advance it properly.

the scipt layers in the main clip are built in the following way:

functions
(contains keyframes at each spot where I want the movie to stop with the following script: stop();

event button
(contains keyframes with a button on each, full screen size with a 0% alpha transparency, in the same frame on the timeline as the above "function" with the following script:
on (release, keyPress "<Space>") {
play();
}

movie code
(keyframes placed on the following frame of the timeline from the above 2 layers and contains the script:
mytarget.unloadMovie();
mytarget.loadMovie("[nameofmovie].swf");

myclips
(contains single blank movie called "mytarget")

each child clip has a function layer with the script "stop();" at the end to keep it from looping. The ones that have stops in the middle contain the same script as to where they stop.

the swf can be viewed at the following link:
http://www.whiteboxerdesign.com/test...esentation.swf

i'm at a loss as to what the problem is. Can anyone help?

View Replies !    View Related
If A Child Is Added In A Movie Clip Remove
if a child has been added inside a movie clip and I wish to check from the main time line and if the child == true then remove.

if (MENU.dropdownmenu == true){
MENU.removeChild(MENU.dropdownmenu);}

is this the code because the remove bit works but if statement doesn't work

anyone have any ideas why ? I'm scratching my head

View Replies !    View Related
Controlling Tween From Within Child Movie Clip
I have a moveclip Named photoStrip_MC that is tweened to scroll across my flash page, I have each photo in the photoStrip_MC as a movie clipped named photo1_MC and so on.

What is happening is, I'm trying to stop and resume the tween of photoStrip_MC when there is a MouseOver of each photos movie clip.

What keeps happening though is flash is telling me that the tween is possibly undefined when I have my AS inside the photoStrip_MC, or it tells me that the photo1_MC is possibly undefined when I have it on the main stage.


How can I get them to communicate with each other?

This is my code with my latest attempt with the MouseOver event in photoStrip_MC trying this.parent.parent


ActionScript Code:
colette1.addEventListener(MouseEvent.MOUSE_OVER, resizePhoto1One);
function resizePhoto1One(event:MouseEvent):void {
    photo1_MC.scaleX *=  1.25;
    photo1_MC.scaleY = photo1_MC.scaleX;
    this.parent.parent.xTween.stop(this.parent);
}
photo1_MC.addEventListener(MouseEvent.MOUSE_OUT, resizePhoto1Two);
function resizePhoto1Two(event:MouseEvent):void {
    photo1_MC.scaleX /= 1.25;
    photo1_MC.scaleY = photo1_MC.scaleX;
    this.parent.parent.xTween.resume(this.parent);
}


And this is the code for the tween on the main stage


ActionScript Code:
var xTween: Tween;
xTween = new Tween(photoStrip_MC,"x",Regular.easeInOut,15,650,14,true);
xTween.addEventListener(TweenEvent.MOTION_FINISH,motionFinish);

function motionFinish(event:TweenEvent):void
{
    xTween.yoyo();
}

Thanks, any help would be appreciated. I had it working until I lumped all the photo MC's into one MC, and I'm new to AS3.

View Replies !    View Related
Acting On Child Movie Clip (again With The Starting Over)
Once more, lost in translation from AS2 to AS3:

In AS2 i can write a function that will affect the child mc of a parent mc. I can change the name of parent mc's, and using "this" I can still affect the child:

ActionScript Code:
//I've been using Fuse for stuff...function changeColor(fillColor){this.childMC.colorTo(fillColor);}parent1.onRollOver=function(){changeColor("0x000000")}parent2.onRollOver=function(){changeColor("0xFFFFFF")}
and so on.

Now, I've learned some AS3 stuff, about using switch statements to call a function on multiple targets:

ActionScript Code:
//as3, function showCover(e:Event):void{    var target:DisplayObject=e.currentTarget as DisplayObject;        switch(target){        case btn1:        loadImage("sw_covers/episodeI.jpg");        break;                case btn2:        loadImage("sw_covers/episodeII.jpg");        break;        }}


but how to access the child mc within? Nothing I've tried works.

thanks for helping out an old-time-noob.

View Replies !    View Related
Trying To Reach A Child/embedded Movie Clip
Hey guys... i'm new to the AS3 format and wow has it changed. but i don't know how to correctly ask this question, so forgive me if this is addressed in another post...but please provide the link..hahaha

here's my problem I'm trying to reference a dynamically created movie clip

function getContentData(xmlData):void {
for (var i:int = 0; i < xmlData.*.length(); i++) {
var mc:MovieClip=new navButtonAction();
mc.name = "mc"+i
mc.x=500 +(i*250);
mc.y=10;
mc.currentBut.text = xmlData.*[i].name();
//mc.imageShell.pctFieldText.text = "show % loaded here";
navMenu.addChild(mc);

loadImage("photo.jpg");
}
}


function loadImage(url:String):void {
// Set properties on my Loader object
imageLoader = new Loader();
imageLoader.load(new URLRequest(url));
imageLoader.contentLoaderInfo.addEventListener(Pro gressEvent.PROGRESS, imageLoading);
imageLoader.contentLoaderInfo.addEventListener(Eve nt.COMPLETE, imageLoaded);

}

function imageLoading(erogressEvent):void
{
***so the question is... how would i talk to the dynamically created "mc" here.***
so i can pass the preloading tally.
}

View Replies !    View Related
Creating A Function On The Root Timeline From A Child Clip?
How do I creating a function on the root timeline from a child clip? This is the function I need to create:

function up(men_num) {
var men_offset=offset[men_num]-30;
men_num++;
for(i=men_num; i<=5; i++){
MenuArray[i]._y-=men_offset;
}
}

function down(men_num) {
var men_offset=offset[men_num]-30;
men_num++;
for(i=men_num; i<=5; i++){
MenuArray[i]._y+=men_offset;
}
}

View Replies !    View Related
Help: Assigning Event Handlers To Parent And Child Clip, Possible?
I am creating a UI today that has a fairly complex interaction.
And I need to do roughly the following:

Assign onRollOver/onRollOut event handlers to mcParent
Assign onPress handle to mcChild (contained inside mcParent)

I find that once mcParent is given an event, the child event handler can no longer work, even though the event is different.

Am I missing something here, or is this just plain not possible?

View Replies !    View Related
How Do I Find The Dimensions Of A Child Clip, In Global Pixels?
So with localToGlobal, you can get a nested coordinates' position on the global stage...I'm looking for the equivalent of that in terms of pixel width and height.

What I have is a child clip within a container clip. When I scale the parent clip, how do I find what the actual pixel size of the child clip is? My trace statements tell me that the child clip's _width and _height properties don't change, just as their _x and _y don't change.

View Replies !    View Related
Controlling Multiple Instances Of A Child Movie Clip
Hello,

I have a parent movie clip (instance name is Dandelion) that contains hundreds of instances (unnamed) of a child movie clip called Seedling. (so seedlings floating away from a dandelion at different points within the parent movie clip)

On the main timeline I have a 'stop' and 'play' button that control the main timeline and parent movie clip just fine. But the buttons have no effect on the child movie clips which just continue to play independently.

It would be too much work to go back and name every instance of the child movie clip and then code it into the button

_root.Dandelion.seedling1.stop();......

There must be a quicker and more efficient way! Is there a way to go into the child movie clip and code it to respond to the stop and play buttons in the main timeline? Or to have it stop when the parent movie clip stops?

View Replies !    View Related
Targeting Child Movie Clip OnRollOver Issues
I'm been writing AS for a while so I'm totally stumped on this one. How do you target the child clip of a movie for a rollOver action? Here is the code I am using - pretty straight forward. I have one clip called main_mc that has two clips within it: mc1 and mc2. I can set the alpha property with this targeting, but not the rollover. Nothing gets traced to the output window on rollover of child movieclips. What's going on?

main_mc.onRollOver = function(){
trace("main mc rolled over");
for (i=1; i<3; i++){
this["mc" + i].onRollOver = function(){
trace("mc1 or mc2 rolled over");
}
this["mc" + i]._alpha = 50;
}
}

View Replies !    View Related
Problem Removing Child/wrong Clip Loads
OK, I'm getting a bizarre bug that I can't seem to find a solution to, maybe I'm missing something.

Basically, if I'm in section 1, a button tells section 1 to load up a diagram specific to section 1. It also checks to see if section 2 is loaded, and removes it.

It I'm in section 2, a button tells section 2 to load up a diagram specific to section 2. It also checks to see if section 1 is loaded, and removes it.

If I'm in neither, the button goes away.

So, on first load, that all works fine.

Here's where bug begins:
User goes from section 1, to section 1 diagram, to section 2, to section 2 diagram, back to section 1, section 1 diagram. Section 1 loads up, but section 1 diagram gets replaced with section 2 diagram.

Again, this only happens after I've clicked on each one once. If I go from section 1, to section 1 diagram, to a section without a diagram, back to section 1 diagram, that all works.

Sorry if this sounds confusing, but it's part of a very large app that I can't upload.

Here's a snippet of code. See anything glaring that I'm missing?


ActionScript Code:
if(section == "Section 1"){     
    btn.visible = true;
    btn.btnTxt.text = "Section 1";
    btn.addEventListener(MouseEvent.CLICK, loadSection1Diagram);
}else if (section == "Section 2"){
    btn.visible = true;
    btn.btnTxt.text = "Section 2";
    btn.addEventListener(MouseEvent.CLICK, loadSection2Diagram);
}else{
    btn.visible = false;
}

private function loadSection1Diagram(e:MouseEvent) {
//check to see if any diagrams are still loaded and remove them
     if(section2 && contains(section2)){
             removeChild(section2)
     }
     section1 = new SectionDiagram;
          addChild(section1);
     }
}

private function loadSection2Diagram(e:MouseEvent) {
//check to see if any diagrams are still loaded and remove them
     if(section1 && contains(section1)){
             removeChild(section1)
     }
     section2 = new SectionDiagram;
          addChild(section2);
     }
}

View Replies !    View Related
Child To Parent Movie Clip Relations Difficulties
I have a Movie Clip that holds a Movie Clip (which loads a picture). However when i set the _x and _y position of the parent movie clip it would appear that the child movie clip goes off center. The code below is the creation and positioning code of the Movie clips.

ActionScript Code:
for (y = 1; y <= _global.pictures; y++){
    //output.text = "box" + y; //used in testing
    // Creates a number of boxes to hold each of the pictures.
    _root.photoArea.duplicateMovieClip("box" + y, y);
    // This loads the pictures into the movies
    _root["box" + y].photoHolder.loadMovie("../PhotoGallery/fla/pic" + y + ".jpg");
    // Places the boxes with pictures loaded on stage
    if(y > 1 && y % 4 == 0){
        setProperty("box" + y,_x, _global.xPos);
        setProperty("box" + y,_y, _global.yPos);
        _global.xPos = 10;
        _global.yPos += _global.picHeight;
        _global.numRow += 1; //adds 1 to number of rows ever time a row is added
        //output.text = y % 4; //This was used for debug
    }else {
        setProperty("box" + y,_x, _global.xPos);
        setProperty("box" + y,_y, _global.yPos);
        _global.xPos += _global.picWidth;
    } // end else
}//end for loop
Here is what it looks like. Is there a way to tell the child to always be at the center location of it's parent?

View Replies !    View Related
Can I Assign A Child State To A Movie Clip That Is Already Placed On Stage
Hello

Is it possible to add a child state to a movie clip that is already placed on stage,
i need to do this so i can move the movieclip to the top of the display list.

thanks for the help
mt

View Replies !    View Related
Trying To Load A Movie Clip From A Child, To The Main Timeline
seems so simple.
I'm just trying to load a movie clip into an empty clip.

here's my code....

loadMovie("_root.portalStage1._global.chosenPic", "_root.printClip");

_root.portalStage1 is the container
that holds the child swf (I tried adding ".swfname" after the container name, but that didn't work either)

_global.chosenPic
contains the name of the movie clip I want to load

_root.printClip is the empty movie clip I'm trying to fill
with "_global.chosenPic"

all this...to make a print button work...
print function really sucks in flash mx...
but that's another thread...

View Replies !    View Related
Trying To Load A Movie Clip From A Child, To The Main Timeline
seems so simple.
I'm just trying to load a movie clip into an empty clip.

here's my code....

loadMovie("_root.portalStage1._global.chosenPic", "_root.printClip");

_root.portalStage1 is the container
that holds the child swf (I tried adding ".swfname" after the container name, but that didn't work either)

_global.chosenPic
contains the name of the movie clip I want to load

_root.printClip is the empty movie clip I'm trying to fill
with "_global.chosenPic"

all this...to make a print button work...
print function really sucks in flash mx...
but that's another thread...

View Replies !    View Related
Changing Size Of Child Clips To Match Parent Movie Clip?
I have a program that is dynamically loading images into a nested movie clip. The Parent movie contains the two separate movies within it and images are to switch back and forth in them. I need to know how I can use action script to load these nested movies to the exact dimension of the parent movieclip.

Here is my code:

onClipEvent (load) {
StagePictures._lockroot = true;

e_mc.loadMovie(_root.PathText+_root.imageClips[0]);

}
onClipEvent (enterFrame) {
if (Key.isDown(a number)) {
if (Key.isDown(Key.something)) {
if (Key.isDown(a number)) {
_root.StagePictures.e_mc.createEmptyMovieClip("Sec ondClip" , 3);
_root.StagePictures.e_mc.SecondClip.loadMovie(_roo t.PathText+_root.imageClips[1]);
_root.ScoreBox.text = scvar+1;
_root.Command.text = _root.imageCommand[1];
_root.Response.text = "Correct!";
}
}
}
}

StagePictures is the parent clip, e_mc is a child, and SecondClip is a child within e_mc.

Both e_mc, and SecondClip are loading the dynamic images which are the paths labeled _root.PathText+_root.imageClips[0, and 1];

The size of the images need to be contained within the size of the parent clip of both called StagePictures.

How can I set the size of the two nested clips to match the parent?

Thanks,
sam

View Replies !    View Related
Create Container Movie Clip And Child Clips At Design Time?
It's always powerful and dynamic to use "createEmptyMovieClip" and "attachmovieclip" at run time. But how to create this relationship of clips at design time so that an empty movie clip can hold several child movie clips?

Thanks!

View Replies !    View Related
Playing Two Dynamic Xml Picture Gallery Backgrounds As Child Clip At Different Times
Hey guys,
I am a web developer but I am a beginner in flash. I have been trying to find a solution to my problem but I haven't had any luck and I am hoping you could point me to the right direction. My problem is I need to load a different background (child) movie clip that would replace the default one when a button is pressed. I have two background movie clips that should be loaded one at a time. I am also going to post a code snippet as I understand people are wary about downloading code from other people.

To summarize, the main file is sample.fla. This loads two background movie clips (bg_1.swf and bg_2.swf) through movieClipLoader.loadClip() method one at a time. It is supposed to swap the bg's depending on which section of the main timeline they are at (through the on release event of the buttons). The default bg is bg_1.swf which is the "nightlife bg". Clicking on "restaurant" loads the second bg (bg_2.swf "restaurant bg") on the same target so that should replace the first/default bg. The problem is it does not. Unloading works but reloading the same target with a different mc only makes it play the current/original background.
I am really starting to get frustrated because it seems like a trivial thing to do. I am just starting to learn flash and I really like to get better at it. I am thinking maybe it is because of the way the background bg is coded that it is not meant to be loaded and reloaded (i did not code the bg's). If anyone could help in any way, it would be very much appreciated. If my technique is wrong and there is an easier way to achieve the bg swaps, please let me know. Thanks in advance! Any help would be greatly appreciated.

View Replies !    View Related
Oop Question: A Simple Way To Access Methods In Child Classes From Other Child Class
hi All, I have another oop question.

I'd like to call a method in a child class from another child class.
I'd like to do it without instantiating the other child class...
an example will be easier to see what I mean

document class

ActionScript Code:
package
{
    import flash.display.*
    public class Tester extends MovieClip
    {
        var ch1:Child1;
        var ch2:Child2;
       
        function Tester()
        {
            ch1 = new Child1();
            ch2 = new Child2();
        }
    }
}
child 1

ActionScript Code:
package
{
    class Child1 extends MovieClip
    {
        function Child1()
        {
            trace("Child1 is working");
        }
       
        public function hello()
        {
            trace("Child1 Hello function")
        }
    }
}
child 2

ActionScript Code:
package
{   import flash.display.*
    class Child2 extends MovieClip
    {
        function Child2()
        {
            trace("Child2 is working");
           
            //Tester.ch1.hello();
        }
    }
}

the commented line in Child2 is what I'm asking about. is there any way to do this without defining the Tester class in Child2?

... I mean, without saying : var tstr:Tester = new Tester(); in Child2... and then calling the function via tstr.hello();

thank in advance guys..

View Replies !    View Related
Stop FLV Playback In Child When Removing Child (or At Least Silence Audio)
I'm working on a flash site with a number of different "states" (home, features, demo, etc.) each of which is a movie clip with its own actionscript, added as a child when requested, removed when the user chooses a new state.

One of the states plays short FLV videos. The problem is, when switching away from that state to a different state, even though the child is removed, the current video apparently keeps playing as I can hear the audio continuing on.

To demonstrate, the site is here. Click on "Demo", then play one of the videos and switch to a different state (home, features, whatever) while the video plays.

I'm trying to call a function in the child to stop video playback (first checking whether the function exists before trying to call it). The checking part works, but the function call is giving me a "call to possibly undefined method" error when publishing. Probably because I'm calling it the wrong way.

Here's the "remove child" code used after switching to a new state:


Code:
var child:DisplayObject;

while(stateContainer.numChildren > 1)
{
child = stateContainer.getChildAt(0);
if ('stopPlayback' in child)
{
trace('exists');
child.stopPlayback();
}
else
{
trace('does not exist');
}

stateContainer.removeChildAt(0);
}
Can you tell me a better way to do this? I find it strange that it traces "exists" when the function exists, but still complains that child.stopPlayback() (might not) exist.

View Replies !    View Related
Variables Of A Child Not Visible To A Function In The Child Called From Its Parent ?
sorry, this is a repeat thread, but couldn't change the title on the old one, someone must know the solution to this problem, I just dont think i worded it correctly enough for someone who knew what i was talking about to notice last time.

Ive got a movieclip that creates and adds a child mc then calls a function in the new mc. the function runs, but the local vars for the new mc aren't visible to the function. Is there a special way to call a function so that its scope is in the child, not in the parent ? ( i assume thats where it is, even though a trace of this returns the correct object type )

ie:

[Parent Clip]
--[child clip: movGraph]
--variable ( var thegraph:MovieClip = this; )
--[function loadMe]
--(trace (theGraph); )

calling movGraph.loadMe spits out undefined or null object error, as opposed to
[object movGraph]

obviously i want to do a whole lot more than trace out the object type, and trace(this) in the function returns [object movGraph]. the variable "theGraph" declared in the child isn't available or its null somehow.

Can anyone tell me where I'm going wrong ? - any help would be appreciated. at the moment I'm having to add all the code in the function instead of the "root" of the child. which really defeats the point.

View Replies !    View Related
Target Clip
Can I define two tagets on one mouse click? How?

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved