Copy link to clipboard
Copied
This works:
layerMenu.duplicateMov(LHolder.L1Holder, layerMenu.getChildByName("layer1"));
This doesn't work:
layerMenu.duplicateMov(LHolder.L1Holder, layerMenu.getChildByName("layer1").L0Dup);
L0Dup is an instance name of a movieclip inside getChildByName("layer1")
Any clues for a workaround?
so, flash doesn't know you boxes can be displayobjectparent class objects. if all the other potoential issues i listed in message 3 do not apply, use:
layerMenu.duplicateMov(LHolder.L1Holder, Box(layerMenu.getChildByName("layer1")).getChildByName("L0Dup"));
Copy link to clipboard
Copied
use:
layerMenu.duplicateMov(LHolder.L1Holder, layerMenu.getChildByName("layer1").getChildByName("L0Dup"));
Copy link to clipboard
Copied
I've tried this, but it doesn't work. The L0Dup has the instance name from inside the library item which has AS linkage "Box" , while "layer1" is from the array of "Box"
Copy link to clipboard
Copied
then you don't have a child of layerMenu.getChildByName("layer1") named "L0Dup" when that code executes or, if you see an error message, you may simply need to cast one or more objects.
so first, is there an error message? if yes, what is it?
then, what is "layer1"?
if that's not a movieclip instance name, that's the first error. and, there may be more errors.
if "laye1" is a child movieclip instance name and there is a child named "L0Dup" on "layer1"'s timeline, the frame that contains L0Dup needs to play before you can use that code. in addition, no other frame of "layer1" that does NOT contain L0Dup can play. ie, once L0Dup is created, it must continue to exist, at least, until that code referencing it executes.
Copy link to clipboard
Copied
Error Message:
Scene 1, Layer 'Layer 1', Frame 1, Line 20 | 1119: Access of possibly undefined property L0Dup through a reference with static type flash.display:DisplayObject. |
L0Dup is always visible, thus playing.
here is the function that creates "layer1" and more.
function createLayerBoxes()
{
for (var i:int = 0; i < NUM_LAYERS; i++)
{
var box:Box = new Box( i + 1 );
box.y = (box.height + LAYER_SPACING) * i;
box.name= "layer" +( i + 1);
box.buttonMode = true;
box.addEventListener( MouseEvent.MOUSE_DOWN, onLayerPress );
box.addEventListener( MouseEvent.MOUSE_UP, onLayerRelease );
addChild( box );
_boxes.push( box );
}
Copy link to clipboard
Copied
so, flash doesn't know you boxes can be displayobjectparent class objects. if all the other potoential issues i listed in message 3 do not apply, use:
layerMenu.duplicateMov(LHolder.L1Holder, Box(layerMenu.getChildByName("layer1")).getChildByName("L0Dup"));
Copy link to clipboard
Copied
That did the trick! Awesome. Thanks!
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now