Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-28-2008, 02:32 PM   #1
um... what?
trymedo's Avatar
Join Date: Aug 2006
Location: Somerset, England
Posts: 123
Red face Selecting an element


I'm sure what I need to do here is actually very simple, but Im having some trouble with it.

My aim is to have one *Template* scene that I set up exactly how I need it, with layers and movieclips all layed out how I want them

Then, in my script, I would like to duplicate this scene, give it a new name, and set up some parameters on the component movieclips on the stage.

I have already managed to duplicate the scene and insert set number of frames, labels & actions. This is fine.
Now I need to loop through the layers elements until I find one called "StepList" and set its "prefix" parameter to a variable string.

This is all I need to do and my first usefull jsfl will be complete

Please, anybody have any ideas?

Build flash sites? - Use the GAIA Framework, it's awesome!

trymedo is offline   Reply With Quote
Old 10-30-2008, 04:44 PM   #2
Join Date: May 2008
Posts: 87

Hopefully you already have some of this, but each layer has an array frames. Each frame has an array elements. To go through every element in the document:
var doc    = fl.getDocumentDOM();
var time   = doc.getTimeline();
var layers = time.layers;
for(var l = 0; l < layers.length; l++){

     // Find every frame in every layer
     var frames = layers[i].frames;
     for(var f = 0; f < frames.length; f++){

          // Find each element in each frame
          var elements = frames[f].elements;
          for(var e = 0; e < elements.length; e++){

               var currentElem = elements[e];
               if (currentElem.libraryItem == "complete/path/to/libitem"){
                     // should set the first parameter
Beginning September 1, 2008:
Beyond the Language: A Programmer's Interlinear Cookbook
CW.Allen-Poole is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
If Array contains...return element number sarumitai ActionScript 2.0 3 06-06-2008 06:02 AM
Delete an element from an xml object jrwalker2 ActionScript 3.0 8 03-18-2008 12:25 AM
URL, Caption and Hover effect on element created with drawCirc arne75 ActionScript 2.0 3 03-31-2006 10:04 PM
Dynamic array element load The Dillo ActionScript 2.0 1 08-19-2005 11:23 PM
Move Element in Array Up and Down in Order Birdsong ActionScript 1.0 (and below) 4 05-29-2004 02:56 PM

All times are GMT. The time now is 04:28 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.