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




Duplicating MCs Not Working When Nested



Hi all!

Got an annoying problem, need help. I'm trying to duplicate MCs ("a1") down and re-set their dynamic text box values ("a1", "a2", etc). Easy enough when testing them as MCs sitting on the main timeline. This code works fine:


on (release) {
amount = 8;
i = 2;
while (amount>0) {
duplicateMovieClip ("_root.a1", "a"+i, i);
_root.distance= (_root.distance)+17;
this["a"+i]._y = _root.distance;
var_text = "a"+i;
_root["a"+i].a_1_var = var_text;
i = i+1;
amount = amount-1;
}
//
}

But, when I try to do the same thing with text MCs inside a movie clip "internal", bupkiss.

on (release) {
amount = 8;
i = 2;
while (amount>0) {
duplicateMovieClip ("_root.internal.a1", "a"+i, i);
_root.distance= (_root.distance)+17;
_root["a"+i]._y = _root.distance;
var_text = "A"+i+"_Option";
_root["a"+i].a_1_name = var_text;
i = i+1;
amount = amount-1;
}
//
}

The "on (release)" action is called from a button on the main timeline. Can anyone spot my problem? (the scripting one)

thanx in A-



FlashKit > Flash Help > Flash ActionScript
Posted on: 10-29-2001, 07:57 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Duplicating In Nested Movieclip
Hi,

I have movieclip that is duplicating with variables from ASP Page.
Here is my code:

xstart = 300;
for (i=0; i<TotalRecords; i++) {
duplicateMovieClip("mc", "mc"+i, i);
telltarget ("mc"+i) {
caption = eval("/:caption" add ../:i);
header = eval("/:header" add ../:i);
body = eval("/:body" add ../:i);
}
setProperty("mc"+i, _y, xstart+i*200);
}

TotalRecords is how many records are coming from my ASP page.
mc is my movieclip instance
the rest are my variables in the movieclip

Now I can get this work when I place the movieclip on the main stage,
but I want to create a scroll from the duplicating movieclip, so I created a new movieclip and placed the mc movieclip inside of it. The new movieclip is now on the main stage. Nothing comes up now. The new movieclip is like a holder for all the duplicating mc's movieclips so I can scroll through it.

Do I place the above code on the main stage or the new movieclip or the mc movieclip and how do I target it so it will be shown on my main stage.

Please Help!
Thank you,
Adam

Duplicating Nested Movieclip
Hi,
Can some one tell me how to duplicate a nested movieclip.

I have a main holder movieclip on the stage(rectangle in shape) in which i have another small moveclip nested.(ball shape)

I need to create duplicate of the nested movieclip (ball) so that it fills the main holder movieclip at runtime.

Can anyone tell how this can be done.


Thanks in advance.

Amit.R.Chinchane

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

Duplicating MC's In Loop Not Working...
I can't figure out why the "for" loop that I wrote in this code isn't working. It's supposed to create a number of MC instances (lowering each one by 20 pixels each time), but it seems as though only one keeps getting created. The following link (only 8kb) has my Flash file along with the supplemental XML file (put that in there so you could avoid errors when testing the movie):

http://al-i.anixter.com/TEMP/flash_template.zip

If someone could please look at this, I'd appreciate it. It's a very small amount of code, so it shouldn't be too confusing or anything. Thanks!...

Why This Duplicating Movieclip File Stops Working Properly When It's Embedded?
As, the title suggests, I've got the following file which works prefectly on its own but when it is embedded in another swf, I get problems.

What happens is that whenever I drag any instance onto the stage, as soon as I go to select and drag another one, the old one vanishes.

Any idea why this is? (file is attached)

Thanks

Working Between Nested .swf's
alright, i have a main.swf and it loads another into it using this command (current is just a variable to decide which layer)


Code:
loadMovieNum("string"+current+".swf", current);


i want to be able to tell this loaded .swf to do something by using a function that for fun we will call pop().

what i want to know is how, from main, i can tell this .swf to do that. I dont care whether the pop() function is located in the main or other swf. Which ever you all think is better.

[cs3, As2] Nested Txt Not Working With XML
Hi im having problems with my xml banner, i have some txt that is nested in a movieclip that animates on as each image is loaded. Initially i couldnt even get the txt to show up, after i used _root, the txt now pops up but only for a split sec and then dissapears and dosent' reapear at all. Any idea what i need to change. Here's the code im using.

[cs3, As2] Nested Txt Not Working With XML
Hi im having problems with my xml banner, i have some txt that is nested in a movieclip that animates on as each image is loaded. Initially i couldnt even get the txt to show up, after i used _root, the txt now pops up but only for a split sec and then dissapears and dosent' reapear at all. Any idea what i need to change. Her'es the code im using.







Attach Code

function loadXML(loaded)
{
if (loaded)
{
xmlNode = this.firstChild;
image = [];
description = [];
bodytext = [];
bodytext2 = [];
bodytext3 = [];
credit = [];
imagelink = [];
total = xmlNode.childNodes.length;
for (i = 0; i < total; i++)
{
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
bodytext[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
bodytext2[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
bodytext3[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
credit[i] = xmlNode.childNodes[i].childNodes[5].firstChild.nodeValue;
imagelink[i] = xmlNode.childNodes[i].childNodes[6].firstChild.nodeValue;
} // end of for
firstImage();
}
else
{
content = "file not loaded!";
} // end else if
} // End of the function
function firstImage()
{
if (loaded == filesize)
{
picture._alpha = 0;
slide._alpha = 0;
picture.loadMovie(image[0], 1);
_root.TxtBar_mc.newsBox.text = description[0];
newsBody.htmlText = bodytext[0];
bullet2.htmlText = bodytext2[0];
bullet3.htmlText = bodytext3[0];
creditBox.text = credit[0];
slideshow();
TxtBar_mc.gotoAndPlay(1);
ShowHideButtons();
} // end if
} // End of the function
function prevImageMove()
{
clearInterval(myInterval);
prevImage();
slideshow();
} // End of the function
function nextImageMove()
{
clearInterval(myInterval);
nextImage();
} // End of the function
function prevImage()
{
if (p > 0)
{
--p;
picture._alpha = 0;
slide._alpha = 0;
picture.loadMovie(image[p], 1);
_root.TxtBar_mc.newsBox.text = description[p];
newsBody.htmlText = bodytext[p];
bullet2.htmlText = bodytext2[p];
bullet3.htmlText = bodytext3[p];
creditBox.text = credit[p];
ShowHideButtons();
TxtBar_mc.gotoAndPlay(1);
}
else
{
p = p + 4;
picture._alpha = 0;
slide._alpha = 0;
picture.loadMovie(image[p], 1);
_root.TxtBar_mc.newsBox.text = description[p];
newsBody.htmlText = bodytext[p];
bullet2.htmlText = bodytext2[p];
bullet3.htmlText = bodytext3[p];
creditBox.text = credit[p];
ShowHideButtons();
TxtBar_mc.gotoAndPlay(1);
} // end else if
} // End of the function
function nextImage()
{
if (p < total - 1)
{
++p;
if (loaded == filesize)
{
picture._alpha = 0;
slide._alpha = 0;
picture.loadMovie(image[p], 1);
_root.TxtBar_mc.newsBox.text = description[p];
newsBody.htmlText = bodytext[p];
bullet2.htmlText = bodytext2[p];
bullet3.htmlText = bodytext3[p];
creditBox.text = credit[p];
TxtBar_mc.gotoAndPlay(1);
ShowHideButtons();
} // end if
}
else
{
p = 0;
picture._alpha = 0;
slide._alpha = 0;
picture.loadMovie(image[0], 1);
_root.TxtBar_mc.newsBox.text = description[0];
newsBody.htmlText = bodytext[0];
bullet2.htmlText = bodytext2[0];
bullet3.htmlText = bodytext3[0];
creditBox.text = credit[0];
TxtBar_mc.gotoAndPlay(1);
ShowHideButtons();
} // end else if
slideshow();
} // End of the function
function ShowSelectedImage(input)
{
clearInterval(myInterval);
p = input;
picture._alpha = 0;
slide._alpha = 0;
picture.loadMovie(image[p], 1);
_root.TxtBar_mc.newsBox.text = description[p];
newsBody.htmlText = bodytext[p];
bullet2.htmlText = bodytext2[p];
bullet3.htmlText = bodytext3[p];
creditBox.text = credit[p];
slideshow();
TxtBar_mc.gotoAndStop(6);
ShowHideButtons();
} // End of the function
function Wait()
{
clearInterval(myInterval);
PauseButton._visible = false;
playButton._visible = true;
} // End of the function
function Resume()
{
nextImage();
PauseButton._visible = true;
playButton._visible = false;
} // End of the function
function ShowHideButtons()
{
if (p == 1)
{
Button2Roll._visible = true;
Button1Roll._visible = false;
Button3Roll._visible = false;
Button4Roll._visible = false;
Button5Roll._visible = false;
}
else if (p == 2)
{
Button3Roll._visible = true;
Button1Roll._visible = false;
Button2Roll._visible = false;
Button4Roll._visible = false;
Button5Roll._visible = false;
}
else if (p == 3)
{
Button4Roll._visible = true;
Button1Roll._visible = false;
Button3Roll._visible = false;
Button2Roll._visible = false;
Button5Roll._visible = false;
}
else if (p == 4)
{
Button5Roll._visible = true;
Button1Roll._visible = false;
Button2Roll._visible = false;
Button3Roll._visible = false;
Button4Roll._visible = false;
}
else if (p == 0)
{
Button1Roll._visible = true;
Button2Roll._visible = false;
Button3Roll._visible = false;
Button4Roll._visible = false;
} // end else if
} // End of the function
function slideshow()
{
function pause_slideshow()
{
clearInterval(myInterval);
if (p == total - 1)
{
p = 0;
firstImage();
}
else
{
nextImage();
} // end else if
} // End of the function
myInterval = setInterval(pause_slideshow, delay);
} // End of the function
Button1Roll._visible = false;
Button2Roll._visible = false;
Button3Roll._visible = false;
Button4Roll._visible = false;
Button5Roll._visible = false;
newsBody.html = true;
delay = 8000;
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("news2.xml");
listen = new Object();
listen.onKeyDown = function ()
{
if (Key.getCode() == 37)
{
prevImage();
}
else if (Key.getCode() == 39)
{
nextImage();
} // end else if
};
Key.addListener(listen);
previous_btn.onRelease = function ()
{
prevImageMove();
};
next_btn.onRelease = function ()
{
nextImageMove();
};
Button1.onRelease = function ()
{
ShowSelectedImage(0);
};
Button2.onRelease = function ()
{
ShowSelectedImage(1);
};
Button3.onRelease = function ()
{
ShowSelectedImage(2);
};
Button4.onRelease = function ()
{
ShowSelectedImage(3);
};
Button5.onRelease = function ()
{
ShowSelectedImage(4);
};
PauseButton.onRelease = function ()
{
Wait();
};
playButton.onRelease = function ()
{
Resume();
};
photourl.onRelease = function ()
{
getURL(imagelink[p], "");
};
p = 0;
this.onEnterFrame = function ()
{
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize)
{
preloader.preload_bar._xscale = 100 * loaded / filesize;
}
else
{
preloader._visible = false;
if (picture._alpha < 100)
{
picture._alpha = picture._alpha + 10;
} // end if
if (slide._alpha < 80)
{
slide._alpha = slide._alpha + 7;
} // end if
} // end else if
};

HELP: It's Not Working When Nested
Hello,

I have a movie which should work this way below
http://www.allanrestauro.com/swf/weddings_intro.swf

But when it's nested together with the main movie
www.allanrestauro.com (click on WEDDINGS)

It's no longer working the way it's should be. How is this possible when it works fine when run in FLASH PLAYER. Here are the source codes....

http://www.allanrestauro.com/downloa.../interface.fla
http://www.allanrestauro.com/downloa...ings_intro.fla



Thanks

Nested Function Not Working
Hi, i'm trying to get my gallery scroller to activate on scrollwheel instead of just button click - to do this i've added the listener code and nested the scrolling function inside, however the nested function is not being called at all, is it due to incorrect syntax or something?

Individually the components work fine, i can get traces back on the mousewheel and the scroller does work on button click...Think i am joining the two together incorrectly.



Code:
var yPositions = new Array(0, -150, -300, -450, -600);
var mouseListener = new Object();
mouseListener.onMouseWheel = function(delta) {
// this is an array for storing the positions of the slider
function jumpTo(number) {
// this function takes the variable "number" that is passed from the buttons and takes the corresponding
// value from the array of positions, then sets the new position in the slider to the new position.
slider.newY = yPositions[number];
trace(slider.newY);
trace("test");
}
};
Mouse.addListener(mouseListener);
stop();
Thanks for any help!

Nested Button Not Working
I have a button with a simple rollover efffect nested in a movie clip... but the rollover effect does not work from within the movie clip. anyone?
-M

Nested If Statement Working In FP6 Not FP7/8
I'm having trouble to get the following code to work in Flash Player 7 or 8. It works fine in 6 though. I think it is something to do with the nested If statement. Any help would be greatly appreciated.

By the way I need it to work in FP8 because I will be adding some functionality that requires this.

Oh, I am using Adobe Flash CS3

Many thanks
Hamish

loadMovie("images/1.jpg", "image");
// resize actions//
var stuff = new Object();
// add an 'onResize' method to our custom object.
stuff.onResize = function() {
stretchIt();
};
// the function that actually does the stretching..
function stretchIt() {
if (stage.width<1440 || stage.height<1080) {
if (stage.height>(.75*stage.width)) {
image._width = Stage.height/.75;
image._height = Stage.height;
image._x = 0-(0.5*(Stage.height/.75))+(0.5*stage.width);
image._y = 0;
} else {
image._width = Stage.width;
image._height = Stage.width*.75;
image._x = 0;
image._y = 0-(0.5*(Stage.width*.75))+(0.5*stage.height);
}
} else {
image._width = 1440;
image._height = 1080;
image._x = .5*Stage.width-(.5*1440);
image._y = .5*Stage.height-(.5*1080);
}
}
// set the scalemode property so that nothing 'auto-scales'
Stage.scaleMode = "noScale";
// set the align property so that everything aligns to the upper left
Stage.align = "tl";
// register our custom object with the Stage object.
Stage.addListener(stuff);
// stretch the clip when we init
stretchIt();
stop();

Working With Nested DisplayObjects
Greetings,

I'm creating my first AS3 project and I've already hit my first snag, nested display objects (aka buttons and movieClips). Let's say you create a movieClip and place buttonA on frame 1 and buttonB on frame 10. You create a class for that movieClip that tells it to jump to frame X after evoking a custom method. With the same method you want to assign the buttons on that frame their functions, but you can't because Flash thinks that DisplayObject does not exist.

How do you make sure all DisplayObjects for a frame have been loaded, so that you can reference them?

I have figured a way around it by using the ADDED event listener. Apparently this event is triggered every time any DisplayObject is added, whether it is nested or not. What's interesting is the number of children (numChildren) for the parent movieClip stays constant. So, this code takes advantage of that fact.


ActionScript Code:
package com {

    import flash.display.*;
    import flash.events.*;
   
    public class Pages extends MovieClip {
       
        var lbl:String;
       
        function Pages(prmLabel:String) {
            trace("Pages");
            changePage(prmLabel);
        }
       
        function changePage(prmLabel:String):void {
            trace("Change Page: " + prmLabel);
            lbl = prmLabel;
            this.gotoAndStop(lbl);
            this.addEventListener(Event.ADDED, lstAdded);
        }
       
        function lstAdded(e:Event):void {
            trace("lstAdded");
           
            var frameLoaded:Boolean = true;
            for (var i:Number = 0; i < numChildren; i++) {
                if (getChildAt(i) == null) {
                    frameLoaded = false;
                }
            }
           
            if (frameLoaded) {
                this.removeEventListener(Event.ADDED, lstAdded);
               
                switch (lbl) {
                    case "one":
                        getChildByName("btnNext").addEventListener(MouseEvent.CLICK, fncNext);
                        break;
                   
                    case "two":
                        getChildByName("btnBack").addEventListener(MouseEvent.CLICK, fncBack);
                        break;
                }
            }
        }
       
        function fncNext(e:MouseEvent):void {
            trace("NEXT");
            changePage("two");
        }
       
        function fncBack(e:MouseEvent):void {
            trace("BACK");
            changePage("one");
        }

    }
}


Personally, I like having menus and such spaced along a time line, especially when they will share things like backgrounds and certain bits of text.

I don't know if there is a better way to do this, or an Event type that I'm not aware of, but this is the only way I can get'er done. Any advice is always welcome.

Components Not Working In Nested Swf
Hello,
I am trying to load and mp3 player swf that uses components (and a php file), into my main flash movie. It loads but none of the components work, i.e the combo box does not drop down. I tested the file on its own in a browser and it works fine, but not when I use loadMovie to load it into my main flash movie. Any help would be appreciated.

I would just build the mp3 player in my main movie but I read in the help files that components have to be in frame 1 in order to work. This sounds extremly limiting so I know there has to be a way around that.

Thanks

Nested Movieclips Not Working Right
I have a pop out menu with a series of movieclip buttons nested inside. If I hard-code the movieclip buttons they work fine, but if I try to target them with AS in the first frame they still behave like buttons, but they don't execute the gotoAndStop.

Also if I pull the movieclip buttons out of the menu movieclip I can target them with AS and they work just fine. It's only when they are inside the other MC's that I can't control them with AS in the first frame.

I know this is a seriously simple problem that I am just overlooking, but I've been at it for two days and can figure out why these infernal buttons work work.

Somebody please, please take a look and tell me what boneheaded script error i've made. Here's the AS I'm trying to use to have the "portfolio" button send the main timeline to the second frame ("test").


ActionScript Code:
_root.menu_***.popup.port_btn.onRelease = function () {    _root.gotoAndStop("test");}



Again, it works fine if I hard code the buttons and put the script directly on the movieclip button, but I don't want to do that.

All the best,
Will

Nested Component Not Working Properly
http://www.geccogroup.com/flash/layout.html

I'm using MX.

If you click on "Entertainment" you will notice a nav menu appear on the right-side panel on stage. This is a movie clip("enter_menu"), which I've engaged using attachMovie. Inside the movieclip are 7 instances of the a component (buttonMC). Inside the component is a tweened button instance on the bottom layer, and a dynamic text field on the top layer.

I started by making this menu in a separate flash movie. On finding that the movie was only 1KB big, I decided to put the MC in my main movie and use it with attachMovie. On it's own, the button text labels show up fine, but when used in my main movie, they do not. Please help!!

S.

Nested Movie Clip Not Working
Could someone please help me out on this small issue? In my flash file, I have a button called health programs (main movie file, underneath Lincoln folder). When a visitor's rolls over this button, all I want is for a nested movie clip to play a specific frame label (lincolnHealth). I wrote a function like this in my first frame of my main movie file (first frame, top of file, very bottom of action script):


Code:
function lincolnsubmenu(){
if(lincolnsub=="lincolnHealth"){
lincolnHealthMenumc.play();
}
}
lincolnsub is the variable, lincolnHealth is the frame label in the nested movie clip. On the button itself, I say this (frame 20, main movie file):


Code:

healthProgramsBtn.onRollOver=function(){
lincolnHealthMenumc.gotoAndStop("lincolnHealth");
}
Then in my nested movie clip, in my first frame of AS, I set the variable and frame label like so:


Code:
_parent.lincolnsub="lincolnHealth";
I know my button fires, my nested movie clip just doesn't play. Surely that makes sense to someone. This same problem has been nagging at me for three days now. Attached in the stripped down version. I done a similiar approach with highlights in this same project and everything worked peachy. If anyone can give a hint, I would be extremely grateful.

http://midwestwebdesign.net/temp/tour.zip

Preloader Not Working - Nested Functions
hello, all

i have made some code to access an internal preloader named 'Preloader' in a keyframe on my main mc's timeline (keyframe 'contact' to load an ext swf), as follows, which works just fine:


Code:
//linkage name for the preloader mc
import lib.Preloader;

urlRequest = new URLRequest("contact.swf");
loader.load (urlRequest);

loader.contentLoaderInfo.addEventListener( ProgressEvent.PROGRESS, preloaderProgress );
loader.contentLoaderInfo.addEventListener( Event.COMPLETE, preloaderComplete );

var preloader:MovieClip = new Preloader();
preloader.progressBar.scaleX = 0.0;
mcHolder.addChild( preloader );

preloader.x = 720;
preloader.y = 538;

function preloaderProgress( event:ProgressEvent ):void
{
var percent:Number=event.bytesLoaded/event.bytesTotal*100;

if ( percent == 100 )
{
loader.contentLoaderInfo.removeEventListener(Progr essEvent.PROGRESS, preloaderProgress);
}
else
{
Display the % loaded in textfield
preloader.lpc.text=int(percent)+"%";
preloader.progressBar.scaleX=percent/100;
trace(percent);
}
}

function preloaderComplete( event:Event ):void
{
mcHolder.removeChild( preloader );
addChild( loader );
trace("complete");
loader.contentLoaderInfo.removeEventListener(Event .COMPLETE, preloaderComplete);
}

stop();


the problem is that i am trying to copy the same code into my movie's main init frame instead of on the 'contact' keyframe; here is the whole piece of code, below; the problem is that the preloader loads, but neither the preloaderProgress or the preloaderComplete functions are working within the preloaderCalled function

any suggestions would be greatly appreciated

thanks!


Code:
import fl.transitions.*;
import fl.transitions.easing.*;
import menuSelect;

//linkage name for the internal preloader mc
import lib.Preloader;

home_bu.gotoAndStop("down");
menuSelect.selectedMenu.clicked = home_bu;

home_bu.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
home_bu.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
home_bu.addEventListener (MouseEvent.CLICK, buttonClicked);

about_bu.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
about_bu.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
about_bu.addEventListener (MouseEvent.CLICK, buttonClicked);

sustainability_bu.addEventListener(MouseEvent.MOUS E_OVER, onMouseOver);
sustainability_bu.addEventListener(MouseEvent.MOUS E_OUT, onMouseOut);
sustainability_bu.addEventListener (MouseEvent.CLICK, buttonClicked);

contact_bu.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
contact_bu.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
contact_bu.addEventListener (MouseEvent.CLICK, buttonClicked);

home_bu.buttonMode = true;
about_bu.buttonMode = true;
sustainability_bu.buttonMode = true;
contact_bu.buttonMode = true;

//This loader is used to load the external swf files
var loader:Loader;

//URLRequest stores the path to the file to be loaded
var urlRequest:URLRequest;

//This array holds all the tweens, so they don't get garbbled
var tweens:Array = new Array();

//stores the current page on display
var currentPage:MovieClip = null;

//stores the next page that we are going to display
var nextPage:MovieClip = null;

//called when a menu button is clicked
function buttonClicked (e:Event):void
{
trace("button clicked");
//create a new loader instance
loader = new Loader();

if (e.target == home_bu)
{
urlRequest = new URLRequest("home.swf");
loader.load (urlRequest);
trace("home");
this.gotoAndPlay("home");
}

if (e.target == about_bu)
{
urlRequest = new URLRequest("about.swf");
loader.load (urlRequest);
trace("about");
this.gotoAndPlay("about");
}

if (e.target == sustainability_bu)
{
urlRequest = new URLRequest("sustainability.swf");
loader.load (urlRequest);
trace("sustainability");
this.gotoAndPlay("sustainability");
}

if (e.target == contact_bu)
{
//urlRequest = new URLRequest("contact.swf");
//loader.load (urlRequest);
trace("contact");
this.gotoAndPlay("contact");
}

//toggle the menu buttons
if (e.target.currentLabel != "down")
{
if (menuSelect.selectedMenu.clicked != undefined)
{
menuSelect.selectedMenu.clicked.gotoAndStop("up");
}

menuSelect.selectedMenu.clicked = e.target;
e.target.gotoAndStop("down");
}

//we want to know when the next page is finished loading
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, fileLoaded);

}

//for rollovers - button state
function onMouseOver(event:MouseEvent):void
{
if (event.currentTarget.currentLabel != "down")
{
event.currentTarget.gotoAndStop("over");
}
}

function onMouseOut(event:MouseEvent):void
{
if (event.currentTarget.currentLabel != "down")
{
event.currentTarget.gotoAndStop("up");
}
}

//called when we have finished loading a content page
function fileLoaded(e:Event):void
{
//The loader contains the page we are going to display.
nextPage = e.target.content;
//animate the current page away from the stage, but first we need to make sure there is a current page on the stage
if(currentPage != null)
{
//tween the current page from left to the right
var tweenX:Tween = new Tween(currentPage, "x", Regular.easeOut, currentPage.x, 500, 1, true);
//Decrease the alpha to zero
var tweenAlpha:Tween = new Tween(currentPage, "alpha", Regular.easeOut, 1, 0, 1, true);
//push the tweens into an array
tweens.push(tweenX);
tweens.push(tweenAlpha);
//currentPageGone will be called when the tween is finished
tweenX.addEventListener(TweenEvent.MOTION_FINISH, currentPageGone);
}

//there is no current page, so we can animate the next page to the stage; the animation is done in the showNextPage function
else
{
//bypass preloaderCalled and use showNextPage instead if you don't want to use the preloader for small external files
//showNextPage();
preloaderCalled();
}
}

//animates and displayes the next page, which is an etxernal mc
function showNextPage():void
{

//tween the next page from left to the center
var tweenX:Tween = new Tween(nextPage, "x", Regular.easeOut, -200, 0, 1, true);
//tween the alpha to from 0 to 1
var tweenAlpha:Tween = new Tween(nextPage, "alpha", Regular.easeOut, 0, 1, 1, true);

//push the tweens into an array
tweens.push(tweenX);
tweens.push(tweenAlpha);

//add the next page to the stage using the lowest level, mcHolder to keep things under the nav etc
mcHolder.addChild(nextPage);

//next page is now our current page
currentPage = nextPage;
}

//This function is called when the current page has been animated away
function currentPageGone(e:Event):void
{
//remove the current page completely (out of the mcHolder)
mcHolder.removeChild(currentPage);

//then show the next page - bypass preloaderCalled and use showNextPage instead if you don't want to use it for small external files
//showNextPage();
preloaderCalled();
}

function preloaderCalled():void
{

loader.contentLoaderInfo.addEventListener( ProgressEvent.PROGRESS, preloaderProgress );
loader.contentLoaderInfo.addEventListener( Event.COMPLETE, preloaderComplete );

trace("preloader initially called");

var preloader:MovieClip = new Preloader();
preloader.progressBar.scaleX = 0.0;
mcHolder.addChild( preloader );

preloader.x = 720;
preloader.y = 538;

trace(preloader.x);

function preloaderProgress( event:ProgressEvent ):void
{
var percent:Number=event.bytesLoaded/event.bytesTotal*100;
trace(percent);

if ( percent == 100 )
{
loader.contentLoaderInfo.removeEventListener(Progr essEvent.PROGRESS, preloaderProgress);
}
else
{
//Display the % loaded in textfield
preloader.lpc.text=int(percent)+"%";
preloader.progressBar.scaleX=percent/100;
trace("should be loading");
}
}

function preloaderComplete( event:Event ):void
{
mcHolder.removeChild( preloader );
addChild( loader );
trace("preloader complete");
loader.contentLoaderInfo.removeEventListener(Event .COMPLETE, preloaderComplete);
showNextPage();
}

}

Nested Movie Rollovers Not Working
Hello,

I'm making a dropdown menu series and I have a movie clip that holds menu buttons (mc_menu).

The rollerOver action for this mc_menu fires a specific action.

The problem arises when the buttons embeded in the mc_menu clip also have mouseOver actions that fire thier own event. When you mouse over the buttons, 80% of the time the mouseOver event does not fire.

Any ideas?

Clem C

Preloader With Nested Functions Not Working
hello, all

i have made some code to access an internal preloader named 'Preloader' in a keyframe on my main mc's timeline (keyframe 'contact' to load an ext swf), as follows, which works just fine:

///////////////////////////////////

//linkage name for the preloader mc
import lib.Preloader;

urlRequest = new URLRequest("contact.swf");
loader.load (urlRequest);

loader.contentLoaderInfo.addEventListener( ProgressEvent.PROGRESS, preloaderProgress );
loader.contentLoaderInfo.addEventListener( Event.COMPLETE, preloaderComplete );

var preloader:MovieClip = new Preloader();
preloader.progressBar.scaleX = 0.0;
mcHolder.addChild( preloader );

preloader.x = 720;
preloader.y = 538;

function preloaderProgress( event:ProgressEvent ):void
{
var percent:Number=event.bytesLoaded/event.bytesTotal*100;

if ( percent == 100 )
{
loader.contentLoaderInfo.removeEventListener(Progr essEvent.PROGRESS, preloaderProgress);
}
else
{
Display the % loaded in textfield
preloader.lpc.text=int(percent)+"%";
preloader.progressBar.scaleX=percent/100;
trace(percent);
}
}

function preloaderComplete( event:Event ):void
{
mcHolder.removeChild( preloader );
addChild( loader );
trace("complete");
loader.contentLoaderInfo.removeEventListener(Event .COMPLETE, preloaderComplete);
}

stop();

///////////////////////////////////

the problem is that i am trying to copy the same code into my movie's main init frame instead of on the 'contact' keyframe; here is the whole piece of code, below; the problem is that the preloader loads, but neither the preloaderProgress or the preloaderComplete functions are working within the preloaderCalled function

any suggestions would be greatly appreciated

thanks!

////////////////////////////////////

import fl.transitions.*;
import fl.transitions.easing.*;
import menuSelect;

//linkage name for the internal preloader mc
import lib.Preloader;

home_bu.gotoAndStop("down");
menuSelect.selectedMenu.clicked = home_bu;

home_bu.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
home_bu.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
home_bu.addEventListener (MouseEvent.CLICK, buttonClicked);

about_bu.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
about_bu.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
about_bu.addEventListener (MouseEvent.CLICK, buttonClicked);

sustainability_bu.addEventListener(MouseEvent.MOUS E_OVER, onMouseOver);
sustainability_bu.addEventListener(MouseEvent.MOUS E_OUT, onMouseOut);
sustainability_bu.addEventListener (MouseEvent.CLICK, buttonClicked);

contact_bu.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
contact_bu.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
contact_bu.addEventListener (MouseEvent.CLICK, buttonClicked);

home_bu.buttonMode = true;
about_bu.buttonMode = true;
sustainability_bu.buttonMode = true;
contact_bu.buttonMode = true;

//This loader is used to load the external swf files
var loader:Loader;

//URLRequest stores the path to the file to be loaded
var urlRequest:URLRequest;

//This array holds all the tweens, so they don't get garbbled
var tweens:Array = new Array();

//stores the current page on display
var currentPage:MovieClip = null;

//stores the next page that we are going to display
var nextPage:MovieClip = null;

//called when a menu button is clicked
function buttonClicked (e:Event):void
{
trace("button clicked");
//create a new loader instance
loader = new Loader();

if (e.target == home_bu)
{
urlRequest = new URLRequest("home.swf");
loader.load (urlRequest);
trace("home");
this.gotoAndPlay("home");
}

if (e.target == about_bu)
{
urlRequest = new URLRequest("about.swf");
loader.load (urlRequest);
trace("about");
this.gotoAndPlay("about");
}

if (e.target == sustainability_bu)
{
urlRequest = new URLRequest("sustainability.swf");
loader.load (urlRequest);
trace("sustainability");
this.gotoAndPlay("sustainability");
}

if (e.target == contact_bu)
{
//urlRequest = new URLRequest("contact.swf");
//loader.load (urlRequest);
trace("contact");
this.gotoAndPlay("contact");
}

//toggle the menu buttons
if (e.target.currentLabel != "down")
{
if (menuSelect.selectedMenu.clicked != undefined)
{
menuSelect.selectedMenu.clicked.gotoAndStop("up");
}

menuSelect.selectedMenu.clicked = e.target;
e.target.gotoAndStop("down");
}

//we want to know when the next page is finished loading
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, fileLoaded);

}

//for rollovers - button state
function onMouseOver(event:MouseEvent):void
{
if (event.currentTarget.currentLabel != "down")
{
event.currentTarget.gotoAndStop("over");
}
}

function onMouseOut(event:MouseEvent):void
{
if (event.currentTarget.currentLabel != "down")
{
event.currentTarget.gotoAndStop("up");
}
}

//called when we have finished loading a content page
function fileLoaded(e:Event):void
{
//The loader contains the page we are going to display.
nextPage = e.target.content;
//animate the current page away from the stage, but first we need to make sure there is a current page on the stage
if(currentPage != null)
{
//tween the current page from left to the right
var tweenX:Tween = new Tween(currentPage, "x", Regular.easeOut, currentPage.x, 500, 1, true);
//Decrease the alpha to zero
var tweenAlpha:Tween = new Tween(currentPage, "alpha", Regular.easeOut, 1, 0, 1, true);
//push the tweens into an array
tweens.push(tweenX);
tweens.push(tweenAlpha);
//currentPageGone will be called when the tween is finished
tweenX.addEventListener(TweenEvent.MOTION_FINISH, currentPageGone);
}

//there is no current page, so we can animate the next page to the stage; the animation is done in the showNextPage function
else
{
//bypass preloaderCalled and use showNextPage instead if you don't want to use the preloader for small external files
//showNextPage();
preloaderCalled();
}
}

//animates and displayes the next page, which is an etxernal mc
function showNextPage():void
{

//tween the next page from left to the center
var tweenX:Tween = new Tween(nextPage, "x", Regular.easeOut, -200, 0, 1, true);
//tween the alpha to from 0 to 1
var tweenAlpha:Tween = new Tween(nextPage, "alpha", Regular.easeOut, 0, 1, 1, true);

//push the tweens into an array
tweens.push(tweenX);
tweens.push(tweenAlpha);

//add the next page to the stage using the lowest level, mcHolder to keep things under the nav etc
mcHolder.addChild(nextPage);

//next page is now our current page
currentPage = nextPage;
}

//This function is called when the current page has been animated away
function currentPageGone(e:Event):void
{
//remove the current page completely (out of the mcHolder)
mcHolder.removeChild(currentPage);

//then show the next page - bypass preloaderCalled and use showNextPage instead if you don't want to use it for small external files
//showNextPage();
preloaderCalled();
}

function preloaderCalled():void
{

loader.contentLoaderInfo.addEventListener( ProgressEvent.PROGRESS, preloaderProgress );
loader.contentLoaderInfo.addEventListener( Event.COMPLETE, preloaderComplete );

trace("preloader initially called");

var preloader:MovieClip = new Preloader();
preloader.progressBar.scaleX = 0.0;
mcHolder.addChild( preloader );

preloader.x = 720;
preloader.y = 538;

trace(preloader.x);

function preloaderProgress( event:ProgressEvent ):void
{
var percent:Number=event.bytesLoaded/event.bytesTotal*100;
trace(percent);

if ( percent == 100 )
{
loader.contentLoaderInfo.removeEventListener(Progr essEvent.PROGRESS, preloaderProgress);
}
else
{
//Display the % loaded in textfield
preloader.lpc.text=int(percent)+"%";
preloader.progressBar.scaleX=percent/100;
trace("should be loading");
}
}

function preloaderComplete( event:Event ):void
{
mcHolder.removeChild( preloader );
addChild( loader );
trace("preloader complete");
loader.contentLoaderInfo.removeEventListener(Event .COMPLETE, preloaderComplete);
showNextPage();
}

}

Nested Movie Rollovers Not Working
Hello,

I'm making a dropdown menu series and I have a movie clip that holds menu buttons (mc_menu).

The rollerOver action for this mc_menu fires a specific action.

The problem arises when the buttons embeded in the mc_menu clip also have mouseOver actions that fire thier own event. When you mouse over the buttons, 80% of the time the mouseOver event does not fire.

Any ideas?

Clem C

AS2 - XML CrossDomain Not Working In Nested SWFs
Hi - I'm hoping someone will have a solution for this problem.

I'm developing an application that communicates with an XML file in a very straight-forward way - THE DATABASE IS ON A SEPERATE SERVER THOUGH - but I do have the crossdomain.xml files in place.

Works fine in Flash, and works fine when I export it with an HTML file and place on my server.

IT DOESN'T seem to work when that SWF is loaded by the MAIN SWF file though.... seems like there is some kind of conflict in the security when that happens....

any ideas of how to fix that?

thanks much in advance....

FLV Playback Controls Not Working When Nested
Hi.

I've got an FLV playback component with a seekbar and replay button and everything works perfectly. When I load it into another mc (or a level) the replay button works once and only once, and the seekbar doesn't scrub to where it's dragged, it just ignores the position and continues playing.
I've been searching for a solution everywhere and completely stumped. Any ideas out there?

Many thanks.

Gary.

Nested Videos And Scroll Pane Not Working.
Hi, I am building a site with Flash 8 and HTML for my company. At first, I was building it bit by bit. I had a .swf file for a video player with navigation for multiple videos; a .swf file for a scroll pane with navigation for multiple stories with art. These files are timeline-based for the navigation.

I decided I wanted to make one large swf file so that I could make the site more cohesive and maybe do something interesting with the background.

I created a new flash file called content, and then created a new movie clip. I went back to my flash file for the video stuff, selected all the frames, then pasted those frames into the movie clip in the content file. I then took all its components and placed them in a sub folder in the library.

I used the same process for the scroll pane file.

When I test the file, the buttons respond when rolled over, but the videos are not showing up at all, nor are the scroll panes.

I am using component panes and video players from Flash, and using linkage dialogs in my library items. Should the linkage reflect that they are in a movie clip and not root? Or maybe point to the sub folder in the Library?

Help! (and thanks in advance).

OPUBCO_Mike

Nested Buttons In DuplicateMovieClip Not Working [Flash 8]
Hello everyone,

This is my first time posting a question to a forum. I have done the due dilagence on this for the last couple of weeks and can't seem to get it to work. I have a movie clip with a simple box and two buttons. The buttons rotate the box CW and CCW.

I want to be able to duplicate the mc, drag the duplicate on stage and and leave the original mc in place. I must be able to make multiple copies of the mc and then have them all be able to retain the button functionality of the original mc and still be individually draggable on stage.

I have the nested buttons working and I have the duplicate/drag-and-drop part working both in seperate .fla files. I cannot, however, for the life of me get them to work together.

Any help would be, of course, greatly appreciated.

Here is the code from the seperate .fla's
---------------------------------------------------------------------
This is my code for copying and retaining drag and drop functionality:

var i = 0;
var deskCopy:MovieClip;
desktest_mc.onPress = function() {
deskCopy = desktest_mc.duplicateMovieClip("desk"+ i, ++i);
deskCopy._x = desktest_mc._x;
deskCopy._y = desktest_mc._y;
deskCopy.startDrag();
this._parent["desk"+ i].onPress = function() {
this.startDrag();
}
this._parent["desk"+ i].onRelease = function() {
this.stopDrag();
}
};
desktest_mc.onRelease = function() {
deskCopy.stopDrag();
};
desktest_mc.onReleaseOutside = function() {
deskCopy.stopDrag();
};

/* This copyies the original desktest_mc and allows all copies to drag and drop after copy */


-------------------------------------------------------------------------------------------------------
This is the code for the movie clip itself:

_parent.desktest_mc.onPressHandler = function(){
trace("hittest(full) was just pressed");
}
// delegate to all children
_parent.desktest_mc.left_mc.onPress = function(){
_parent.hittest_mc.onPressHandler();
trace("left button was just pressed");
_parent.desktest_mc.table_mc._rotation -= 45;
}
_parent.desktest_mc.right_mc.onPress = function(){
_parent.desktest_mc.onPressHandler();
trace("right button was just pressed");
_parent.desktest_mc.table_mc._rotation += 45;
}
_parent.desktest_mc.table_mc.onPress = function(){
_parent.desktest_mc.onPressHandler();
trace("table was just pressed");
}

----------------------------------------------------------------------------------------------------------
On this movie clip, I have the AS code in the mc itself. I don't know if that matters or not, but that does not seem to be the issue as i have tried it numerous ways. Always work by itself, just not after a copy.
I assume the problem with the nested code is it doesn't refer to the copies of itself properly.

Again, any help would be greatly appreciated!!!

Event Handler Not Working On Nested Clip
***Only Works When Checked Online***

I have a movie clip dynamically attached on the main timeline named hold1. Within that movie clip is another clip with an instance name of screen

The event handler:


Code:
hold1.screen.onPress=function(){sayhello(5);}
This works fine if I just target hold1. I have double triple and quadruple checked the instance name screen.What else could be the problem?

Button Nested In Movie Clip Not Working?
I have a movie clip that contains buttons, this takes up one frame in each scene. I cannot get it to go to scenes. I know its the code thats off, so far this is what I have:

on (release) {
gotoAndStop("Bio", 1);
}

Do I need to do a .. or a // ?

Thanks this AS2.0 is killing me...

[F8] For Loop-created Nested Movies Not Working As Buttons.
Desperate!

I'm trying to dynamically create a portfolio presentation based on the contents of an xml file.

This code load sthe XML and fills arrays just fine. It creates a movie called "container+i" nested in the main "thumbnailBar_mc". This all works fine.

The problem is that I can't get those placed png files to act like buttons. When I manually create a clip and nest one the images in it, it works fine. But dynamically, nothing. Please help!


Code:
charts.onLoad = function(success) {
if (success) {
chartingDiagramArray = charts.firstChild.childNodes;
for (i=0; i<chartingDiagramArray.length; i++) {
thumbnailBar_mc.createEmptyMovieClip("container"+i, i);
thumbnailBar_mc["container"+i]._y = 150*i;
loadMovie("thumbs/ch"+i+".png", thumbnailBar_mc["container"+i]);
thumbnailBar_mc["container"+i].onPress = function(){
trace("Button hit");// <----- THIS ISN"T WORKING
}
}
trace("Loaded");
} else {
trace("Not Loaded");
//error message here
}
}

[CS3] Sound Behavior Not Working Within A Nested Loaded Movie
Hi,

Im having trouble with the Load sound and play behaviour in CS3. Basically Ive set up a button to load and play a sound from the library on its first frame e.g.

//Play Internal Sound Behavior
if(_global.Behaviors == null)_global.Behaviors = {};
if(_global.Behaviors.Sound == null)_global.Behaviors.Sound = {};
if(typeof this.createEmptyMovieClip == 'undefined'){
this._parent.createEmptyMovieClip('BS_bgsound',new Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) );
_global.Behaviors.Sound.bgsound = new Sound(this._parent.BS_bgsound);
} else {
this.createEmptyMovieClip('_bgsound_',new Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) );
_global.Behaviors.Sound.bgsound = new Sound(this.BS_bgsound);
}
_global.Behaviors.Sound.bgsound.attachSound("ambie nt");
if (true) {
_global.Behaviors.Sound.bgsound.start(0,1);
}
//End Behavior

Then when it is clicked the sound stops using:

_global.Behaviors.Sound.bgsound.stop("ambient");

This works fine on its own - however the sound button is part of a SWF that is loaded within another SWF (website). When viewed like this the sound does not play.

Has anybody got any ideas please?

Dynamic Text Not Working In Nested Movie Clips
Hello,

I am trying to load text dynamically in a movie clip and I'm stumped as to why it won't work. I can get it to work just fine on the root level but not in my movie clip, where I need it to be. I've creatd a video player and I have a movie clip that holds a scrollable row of thumbnails, so I need the text fields in this movie clip so they'll scroll with the thumbnails. I've tried every tutorial, every example of code online. Any suggestions would be greatly appreciated.

Thank you,

Candace

Menu Button In Nested Mc Not Working (client Getting Impatient...)
Greetings,
I am creating a dropdown menu in an all-flash site.  I finally got the menus to drop and disappear (including a set of sub-menus), but I can't get the buttons to actually move the swf to the desired frame.

It is set up to rollover the menu title, drop down the submenu, and click the button.  The submenu is a movieclip with 2 frames. The menu items are on frame 2. Frame 1 is a stop() frame.

I tried to set the button itself with action to gotoAndStop(23) (for example).  No good.  I tried using:

_root.submenu2.button2.onPress = function() {
    _root.gotoAndStop(23);
};

No good.  

Thanks for your help.
Happy New Year!

Peace, Love & Prosperity!

Text Links In Nested Movies Not Working, Buttons Do Work?
Hi,

I'm pretty new at this but I've managed to create a fairly complex (for me) movie.

Question: Most of the time the text links I create by specifying a URL work just fine; however, sometimes they are just ignored. The text is visible but it does not act as a link. When I edit my way down to the nested movie that contains the text link, it really is a link (dotted underline and the URL box on the text window is correct (http://www.cnn.com for example).

Is there something I'm missing? Like u can only nest so far? etc. I've made simple test movies with nested movies containing text links and they work fine. But my real movie is having trouble with them. It's probably simple but it's driving me mad. Thanks for any ideas.

[CS3] Nested Movie Clips Affecting Main Timeline, Not Working
i have a movie that shows a series of full-size images in succession, but also have a scrolling thumbnail bar below it that i want to be clickable for people to jump to another image if they want. i've got the full-size images working, the scrolling thumbnail bar is working, and i have the buttons in the thumbnail bar connecting to the main timeline where the full-size image movie clips are played, but it's just not working correctly. when i click on the one thumbnail that is currently linked, it will work once or twice and then the second or third time just show a blank 'screen' in the full-size area.

the demo of it is here:

http://beta.candyteria.com/

the .fla is here:

http://beta.candyteria.com/site_reso...me_flash_2.fla

any help would be hot...

Flex Nested Arraycollections And Nested Repeaters
I can't figure out how to get a dataProvider from a nested ArrayCollection. I'll try to provide as much code as possible without dumping my whole project in. If I miss something critical, let me know.

Here is the concept. Clients have Projects. Projects have Images. I want to show this relationship in a form. Displaying the list of Images for each Project is where I'm stumbling.

This is what it looks like in xml.


Code:
<data>

<client name="clientName">

<project name="project1">
<image name="image_1.jpg" />
<image name="image_2.jpg" />
<image name="image_3.jpg" />
<image name="image_4.jpg" />
</project>

<project name="project2">
<image name="image_1.jpg" />
<image name="image_2.jpg" />
</project>

</client></data>
Now, when I load the .xml in, I have custom classes for Clients, ClientList, Project, ProjectList, ImageList and I push all the xml data into that structure. Basically each of the list classes contains a 'list:ArrayCollection' value that contains the various items in that list as well as the functions to add and remove items in the list. The lists are what I use as dataProviders in the form.

Each Client object has a ProjectList that contains all the Projects for that Client. In turn, each Project has an ImageList that contains all the images for that project.

The populateForm below is triggered when a combobox changes. It receives the event with a client attached.


Code:
private function populateForm(event:Event):void{
//selectedClient becomes the
var selectedClient:Object = event.target.selectedItem;
/*this is easy enough. I already gave each client a name value and this displays it to the textfield in my form.*/
clientName.text == selectedClient.name;

/* this is also working. I'm using the 'list:ArrayCollection' of that client's projects as the dataprovider for the first repeater in my form */
projectRepeater.dataProvider = selectedClient.projects.list;

//imageRepeater.dataProvider = ?????

//skipping ahead to my mxml
<mx:Form>
<mx:FormItem>
<mx:VBox>
<mx:Repeater id="projectRepeater">
<mx:Panel width="500" title="{projectRepeater.currentItem.name}">
<mx:VBox width="100%">
<mx:Repeater id="imageRepeater">
<mx:List labelField="name" dataProvider="{????}"/>
</mx:Repeater>
</mx:VBox>

</mx:Panel>
</mx:Repeater>
</mx:VBox>
</mx:FormItem>
</mx:Form>
How do I set an appropriate dataProvider for the imageRepeater? The projectRepeater makes sense because I can layout all projects for each client. But the images are nested. How can I target them?

Referencing A Nested, Nested Movie Clip
Here's the setup.

let's say you have a movie clip called "parent" on the root timeline.
On frame 1 of the parent clip, you have another clip called "childA"
On frame 2 of the parent clip, you have a clip called "childB"

so, only childA is on frame 1, and only childB is on frame 2

also, let's say that both childA and childB each have a local function named "Add"

using dot syntax, you can call those functions from the root timeline:

_root.parent.childA.add(); or _root.parent.childB.add();

however, Flash only seems to be aware of those children that exist on the currently selected frame of the parent. In other words, if the current frame in the parent mc is 1, you can use parent.childA.add(); but not parent.childB.add();

Is there any way to be able to reference a child movie clip in a parent movie clip when the child is not on the currently selected timeline?

I can't put all the child clips on every frame, because I need to be able to print the entire parent movie clip (multiple frames, so each child can only exist in their own frames).

Thanks in advance for your help or insight!

Cheers!

Nested Shapes Vs. Nested Sprites In AS 3.0
Hello,
I'm trying to learn Actionscript 3.0 from the ground up. I am trying to figure out why I can't create nested shape objects in the manner that's demonstrated below w/ Sprite objects.

var container:Shape = new Shape();


When I change the below from a Sprite to a Shape I get this error:

"Call to a possibly undefined method addChild through a reference with static type flash.display:Shape."


var container:Sprite = new Sprite();
container.graphics.lineStyle(0,0xFF6600);
container.graphics.beginFill(0xFF3300);
container.graphics.moveTo(0, 0); // start line @ 10._x and 0 Y
container.graphics.lineTo(100, 0); // move to left 65 x and 0 y
container.graphics.lineTo(100, 100); // from 65 x to 20 y
container.graphics.lineTo(0,100); // 0 x to 20 y

this.addChild(container);
container.x = 140;
container.y = 140;


var box_1:Sprite = new Sprite();
box_1.graphics.lineStyle(0,0xFFFFCC);
box_1.graphics.beginFill(0xFFFF00);
box_1.graphics.moveTo(0, 0); // start line @ 10._x and 0 Y
box_1.graphics.lineTo(80, 0); // move to left 65 x and 0 y
box_1.graphics.lineTo(80, 80); // from 65 x to 20 y
box_1.graphics.lineTo(0,80); // 0 x to 20 y

container.addChild(box_1);
box_1.x = 10;
box_1.y = 10;

var box_2:Sprite = new Sprite();
box_2.graphics.lineStyle(0,0x92E9FE);
box_2.graphics.beginFill(0x92E9FE);
box_2.graphics.moveTo(0, 0); // start line @ 10._x and 0 Y
box_2.graphics.lineTo(60, 0); // move to left 65 x and 0 y
box_2.graphics.lineTo(60, 60); // from 65 x to 20 y
box_2.graphics.lineTo(0,60); // 0 x to 20 y

box_1.addChild(box_2);
box_2.x = 10;
box_2.y = 10;

Thanks,
Eric

How To Play Second Nested Mc After First Nested Mc Finishes?
Hi all,

I am very new to action script - I am sure there is a stupidly simple way to do this:

I have an mc named logoclip. Within logoclip, I have one mc (instance: logointro) nested in frame 1(label: logoin) and one mc (instance: logogrowth) nested in frame 2 (label:logogrow). After the first mc finishes I want the second mc on frame 2 to play. The first mc is tweened with actionscript with the final tween finishing after 132 frames.

I'm not sure what the best way is to do this. Any suggestions?

Cheers

Nested Shapes Vs. Nested Sprites In AS 3.0
Nested Shapes vs. Nested Sprites in AS 3.0

Hello,
I'm trying to learn Actionscript 3.0 from the ground up. I am trying to figure out why I can't create nested shape objects in the manner that's demonstrated below w/ Sprite objects.

var container:Shape = new Shape();


When I change the below from a Sprite to a Shape I get this error:

"Call to a possibly undefined method addChild through a reference with static type flash.display:Shape."


var container:Sprite = new Sprite();
container.graphics.lineStyle(0,0xFF6600);
container.graphics.beginFill(0xFF3300);
container.graphics.moveTo(0, 0); // start line @ 10._x and 0 Y
container.graphics.lineTo(100, 0); // move to left 65 x and 0 y
container.graphics.lineTo(100, 100); // from 65 x to 20 y
container.graphics.lineTo(0,100); // 0 x to 20 y

this.addChild(container);
container.x = 140;
container.y = 140;


var box_1:Sprite = new Sprite();
box_1.graphics.lineStyle(0,0xFFFFCC);
box_1.graphics.beginFill(0xFFFF00);
box_1.graphics.moveTo(0, 0); // start line @ 10._x and 0 Y
box_1.graphics.lineTo(80, 0); // move to left 65 x and 0 y
box_1.graphics.lineTo(80, 80); // from 65 x to 20 y
box_1.graphics.lineTo(0,80); // 0 x to 20 y

container.addChild(box_1);
box_1.x = 10;
box_1.y = 10;

var box_2:Sprite = new Sprite();
box_2.graphics.lineStyle(0,0x92E9FE);
box_2.graphics.beginFill(0x92E9FE);
box_2.graphics.moveTo(0, 0); // start line @ 10._x and 0 Y
box_2.graphics.lineTo(60, 0); // move to left 65 x and 0 y
box_2.graphics.lineTo(60, 60); // from 65 x to 20 y
box_2.graphics.lineTo(0,60); // 0 x to 20 y

box_1.addChild(box_2);
box_2.x = 10;
box_2.y = 10;

Thanks,
Eric





























Edited: 05/20/2008 at 07:46:30 AM by clem_c_rok

Nested Shapes Vs. Nested Sprites In AS 3.0
Hello,
I'm trying to learn Actionscript 3.0 from the ground up. I am trying to figure out why I can't create nested shape objects in the manner that's demonstrated below w/ Sprite objects.

var container:Shape = new Shape();


When I change the below from a Sprite to a Shape I get this error:

"Call to a possibly undefined method addChild through a reference with static type flash.display:Shape."


var container:Sprite = new Sprite();
container.graphics.lineStyle(0,0xFF6600);
container.graphics.beginFill(0xFF3300);
container.graphics.moveTo(0, 0); // start line @ 10._x and 0 Y
container.graphics.lineTo(100, 0); // move to left 65 x and 0 y
container.graphics.lineTo(100, 100); // from 65 x to 20 y
container.graphics.lineTo(0,100); // 0 x to 20 y

this.addChild(container);
container.x = 140;
container.y = 140;


var box_1:Sprite = new Sprite();
box_1.graphics.lineStyle(0,0xFFFFCC);
box_1.graphics.beginFill(0xFFFF00);
box_1.graphics.moveTo(0, 0); // start line @ 10._x and 0 Y
box_1.graphics.lineTo(80, 0); // move to left 65 x and 0 y
box_1.graphics.lineTo(80, 80); // from 65 x to 20 y
box_1.graphics.lineTo(0,80); // 0 x to 20 y

container.addChild(box_1);
box_1.x = 10;
box_1.y = 10;

var box_2:Sprite = new Sprite();
box_2.graphics.lineStyle(0,0x92E9FE);
box_2.graphics.beginFill(0x92E9FE);
box_2.graphics.moveTo(0, 0); // start line @ 10._x and 0 Y
box_2.graphics.lineTo(60, 0); // move to left 65 x and 0 y
box_2.graphics.lineTo(60, 60); // from 65 x to 20 y
box_2.graphics.lineTo(0,60); // 0 x to 20 y

box_1.addChild(box_2);
box_2.x = 10;
box_2.y = 10;

Thanks,
Eric

Nested Shapes Vs. Nested Sprites In AS 3.0
Hello,
    I'm trying to learn Actionscript 3.0 from the ground up.      I am trying to figure out why I can't create nested shape objects in the manner that's demonstrated below w/ Sprite objects.

var container:Shape = new Shape();   


When I change the below from a Sprite to a Shape I get this error:

1061: Call to a possibly undefined method addChild through a reference with static type flash.display:Shape.

Setting The Depth Of A Nested Object Higher Than That Of A Non-nested Object
As the title says, i would like to have an object which is nested beneath another objects depth set higher than that of one the is NOT nested. Is this possible if so how, may be real easy and im just over-looking it but...... help! please

Communicating From A Nested Clip To Another Nested Clip
I keep getting "TypeError: Error #1009: Cannot access a property or method of a null object reference." and I don't understand why.

What I am trying to do is to communicate from inside a movieclip nested in the main timeline to another movieclip nested on the main timeline. And I assume that this is why I am getting the error although I do not understand why or how to fix it.

more details and my code:

I have a menu nested in a movieclip on the main timeline that when activated creates a fog over the images in the background. A series of buttons appear that when clicked removed the fog and play individual movieclips nested in the main timeline.

I am trying to create a rollover that will preview the movieclips before you click on them and confirm your choice.


cutlery_btn.addEventListener(MouseEvent.MOUSE_OVER , onRollOverCutlery);

cutlery_btn.addEventListener(MouseEvent.CLICK, onClickCutlery);

function onRollOverCutlery(event:MouseEvent):void
{
MovieClip(root).cutlery_mc.gotoAndStop(10);
}


function onClickCutlery(event:MouseEvent):void
{
MovieClip(root).gotoAndPlay("cutlery");
MovieClip(root).menuTab_mc.visible = false;
MovieClip(root).fog_mc.play();
}



Thanks for your help!

Duplicating
ok, after too many cups of coffee and racking my brain, I am still unable to figure this out. Hopefully some of you OO Gurus can give me a hand.

I have a movie that pulls its content from an external XML file. What I would like to do is set up a loop with actionScript that creates a button for each element that is found in the XML file. I am able to pull the data that I need from the external file, and dump it into an array, but I am not sure how to create the buttons... I imagine it has something to do with duplicating a pre-existing movie clip, but I'm not sure exactly how this would work. Can anyone offer some advice and / or code examples?

Many thanks.
Marty

Duplicating MCs, Take A Look At This Example
I am trying to create a falling snow effect. I am having the following problems with the script below:

1) it duplicates only once
2) the _x does not change after first duplication.
3) also, a bonus question, how can I time out duplication so that all MC don't snow at the same time.

for (i=0; i<20; i++) {
duplicateMovieClip ("snow", "snow" add i, i);
setProperty ("snow" add i, _x, getProperty("snow" add i, _x)+80);
trace (getProperty("snow" add i, _x));
}


Thanks for your help!

Duplicating MC
I'd like to know how to duplicate a movie clip, multiple times, without having to hand-code each duplication, one at a time. For instance, starting with a box on the left, and having it duplicate itself several times (out to the right), with each box getting progressively lighter (using the alpha setting). Thanks.

Duplicating One Mc
Hello-

I'm a little out of practice so I came here to consult the Flash gurus. I want to take one mc and when the movie is loaded I want to duplicate that mc a random number of times (within 40 or 50) then assign each of those mc's random attributes such as alpha level and dimensions.

I'm assuming it'll be some kind of loop to create the mc's then another loop to assign the attributes to each of the created mc's.

I appreciated any and all help.

Thanks
Dan

Duplicating MCs
hi Guys
i need to get this done:
imagine a movieclip with nothing but a button in it, lets call it "mainMC".
first i load a JPG via loadMovie into another MC which is located inside the "mainMC".
now if i duplicate the "mainMC" it has only the button in it not the loaded JPG, and so i have to load the JPG a second time and a third and so on...

is there a way how i could load the jpg only once in the runtime and then use it for all the copies of "mainMC" i need?

Duplicating?
well for a long time now I've been right clicking on the frame and then pasting it to get another frame of the same, I was wondering if theres an easier way of doing this? for example is there a button I ca push that copy's the current frame and pastes after the frame your currently in???

Duplicating Mcs Into Other Mcs
Hi,

Just a quick one. I need to duplicate an mc but have it duplicate inside another mc, this is so i can scroll a list of dynamically created mcs. What do i need to change to the duplicateMovieClip code?

Cheers.

Steven.

Copyright © 2005-08 www.BigResource.com, All rights reserved