Table MC AS3 n00b question

OK I loaded xml in video clips created dynamically, and when the user clicks on these other dynamically created clips video clip appears with more info loaded in XML. My question is how can I go back the information individually for each clip instead of all at once. My code:

import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.display.MovieClip;
import flash.text.TextField;
import flash.events.MouseEvent;

var theXml:XML;
var loader: URLLoader = new URLLoader();
var mcArray:Array = new Array();
var boxArray:Array = new Array();
Loader.Load (new URLRequest ("template.xml"));
loader.addEventListener (Event.COMPLETE, loadXML);
function loadXML(e:Event):void
{
Check = new XML (e.target.data);
for (var i: Number = 0; i < theXml.name.length (); i ++)
{
var theMC:MovieClip = new MovieClip();
var theText:TextField = new TextField();
theText.text = theXml.name [i]. @ Title;
theText.x = 20;
theText.y = 40;
theText.selectable = false;
theMC.addChild (theText);
theMC.graphics.beginFill (0xff0000);
theMC.graphics.drawCircle (50,50,50);
theMC.graphics.endFill ();
theMC.x = theMC.width * i;
theMC.name = "mc" + i;
mcArray.push (theMC);
mcArray [i] .addEventListener (MouseEvent.CLICK, moClick);

var descBox:MovieClip = new MovieClip();
var descText:TextField = new TextField();
descText.height = 100;
descBox.graphics.beginFill (0xff0000);
descBox.graphics.drawRoundRect (0,0,100,200,10,10);
descBox.graphics.endFill ();
descBox.name = 'box' + i;
descBox.addChild (descText);
boxArray.push (descBox);
mcArray [i] .addChild (boxArray [i]);
descText.text = theXml.name [i]. @ Title + ":"+ theXml.name [i]; ".
boxArray [i] = mcArray [i] there .height-70;
boxArray [i] .visible = false;
addChild (mcArray [i]);

}

function moClick(e:MouseEvent)
{

/ * If I try to put a loop here obviously it would display all and when I try to target by e.currentTarget.boxArray [n] .visible = true;

its not able to find the properties in the table and get the error:

TypeError: Error #1010: a term is undefined and has no properties.

to MethodInfo - 1)

*/


}
}

Any help would be greatly appreciated, thank you!

Load the data separately only must not serious.  I don't see a reason why you want to put a loop in the event handler.  If you add a descBox as a child of each object in mcArray, then you should be able to target the descBox using his name, but I would just change the name to be 'box' for each of them so that you can use the following syntax...

MovieClip (event.currentTarget) .getChildByName ('box');

That should be the object descBox, you have added as a child object theMC as long as you assign it the 'name' box (instead of 'box ' + i).

Tags: Adobe Animate

Similar Questions

  • N00b question - setting Table height

    I have a table inside a layer, I want to put this table to have let say 10 columns and I want the height of the entire table to 100 px.
    What is happening is that the table does not change its size, what is happening, it is that the table is bigger then the div itself in the page.

    So how to change and limit the height of the table as I want?

    Hmmm.

    Best suggestion at this point may be to search the archives. I have
    don't ' know not whence these models 'Halo', but they seem to be
    very popular and also seem a little difficult to customize. I've seen a lot of posts
    has this respect, and I don't ' know not, but perhaps the answer is already
    waiting in the archives.

    The archives can be found here:

    http://groups.Google.com/group/Macromedia.Dreamweaver
    http://groups.Google.com/group/Macromedia.Dreamweaver.AppDev

    Try looking through the archives, if that is not ' fix you, after return.

    For your question, you can't set a height for the table. A table will be extended to
    show everything that is inside.

    You can control the height of the div, and if the div expands to show the content.
    or hides the content that passes over. This is set with the overflow:
    attribute (show/hide/auto).

  • Insert a column in the table (perhaps a silly question?)

    This may seem a stupid question, but is - it possible in Labview to insert a new column in a table that is established? For example, if I have a 2 column table is it possible to insert a new column between two columns? If not is there another tool such as a table or something I should use, and how do you use it?

    Thank you

    Hi LV.

    Use the Vi 'insert Array"as shown:

    RGS,

    Lucither

  • More on my table of full scan question...

    Ok. Apology. start one new thread, like other a receipt very complicated... If anyone can help Id be very grateful, because this results in a significant performance problem...

    XE 11.2

    Re this query:

    Select ENTITY_BUDGET_CAT,

    Sum (actual) real by

    de)

    Select Br ENTITY_BUDGET_CAT_ID as ENTITY_BUDGET_CAT,

    sum (br. BRI_CREDIT) under the real name

    from: br bri_recon

    Group of BR. ENTITY_BUDGET_CAT_ID

    )

    where ENTITY_BUDGET_CAT = (SELECT "EBC". (' ' ID ' FROM 'ENTITY_BUDGET_CAT' "EBC" WHERE 'ENTITY_ID' = 55)

    ENTITY_BUDGET_CAT group

    The query results in a table full of BRI_RECON scan, even if there is an index on BR. ENTITY_BUDGET_CAT_ID... If I put the where conditition on the inner circle question it works fine.

    The void, select retrieve entity_budget_cat on where clause returns a single value.

    If I replace the subselect statement to get the entity_budget_cat with a literal value, it uses the index on ENTITY_BUDGET_CAT and is much faster with a much lower cost.

    If I remove the sum (actual) external and just retrieve the value and no group, it also uses a sweep of indexes on the inner query on BRI_RECON.

    I need instruction in this format because its share actually well expand with unions comprising the sum of 4 tables, then later adds the value of the outer query to retrieve a single value by group of... The docs say that the filter must be passed to any SQL internally, but everything Ive tried to change the query, but leave the internal SQL without a where clause clause and apply it on the outer query. (as I would a view) translates into a full table scan.

    Here is a simple example of the view I have as an example of how the larger view needs to look for tables of the amount and return a single sum by group...

    Create union_sum_view like)

    Select sum (a) as a 'b' b

    de)

    Select nvl (sum (2), 0) as a 'b' of the double

    Union of all the

    Select nvl (sum (2), 0) as a 'b' of the double

    )

    Group by 'b '.

    )

    Select * from union_sum_view where b = (select "b" double)

    Ive tried to put a hint about it, and it doesn't seem to make a difference...

    Ive looked full statistics on the diagram too...

    So my question is: what is causing the full table scan (which is clearly much less effective). And given that I need to build a view in this way, how can I change to use an index in this format, or what I do to make it work...   All variants and the traces are below...

    Select ENTITY_BUDGET_CAT,

    Sum (actual) real by

    de)

    Select Br ENTITY_BUDGET_CAT_ID as ENTITY_BUDGET_CAT,

    sum (br. BRI_CREDIT) under the real name

    from: br bri_recon

    Group of BR. ENTITY_BUDGET_CAT_ID

    )

    where ENTITY_BUDGET_CAT = (SELECT "EBC". (' ' ID ' FROM 'ENTITY_BUDGET_CAT' "EBC" WHERE 'ENTITY_ID' = 55)

    ENTITY_BUDGET_CAT group

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    ---------------------------------------------------------------------------------------------------------------
    | 0 | SELECT STATEMENT | 230. 3910 | 3335 (3) | 00:00:41 |
    | 1. HASH GROUP BY. 230. 3910 | 3335 (3) | 00:00:41 |
    |* 2 | VIEW | 230. 3910 | 3333 (3) | 00:00:40 |
    | 3. HASH GROUP BY. 230. 1610. 3333 (3) | 00:00:40 |
    | 4. TABLE ACCESS FULL | BRI_RECON | 589K | 4031K | 3287 (2) | 00:00:40 |
    | 5. TABLE ACCESS BY INDEX ROWID | ENTITY_BUDGET_CAT | 1. 8. 2 (0) | 00:00:01 |
    |* 6 | INDEX RANGE SCAN | ENTITY_BUDGET_CAT_ENTITY_IDX1 | 1 | | 1 (0) | 00:00:01 |
    ---------------------------------------------------------------------------------------------------------------
    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------
    2 - filter("ENTITY_BUDGET_CAT"= (SELECT "EBC".")) ID""ENTITY_BUDGET_CAT""EBC"WHERE
    'ENTITY_ID' = 55))
    6 - access ("ENTITY_ID" = 55)

    Select ENTITY_BUDGET_CAT,

    Sum (actual) real by

    de)

    Select Br ENTITY_BUDGET_CAT_ID as ENTITY_BUDGET_CAT,

    sum (br. BRI_CREDIT) under the real name

    from: br bri_recon

    Group of BR. ENTITY_BUDGET_CAT_ID

    )

    where ENTITY_BUDGET_CAT = (382)

    ENTITY_BUDGET_CAT group

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    ----------------------------------------------------------------------------------------------------
    | 0 | SELECT STATEMENT | 1. 17. 54 (0) | 00:00:01 |
    | 1. GROUP SORT BY NOSORT | 1. 17. 54 (0) | 00:00:01 |
    | 2. VIEW | 1. 17. 54 (0) | 00:00:01 |
    | 3. GROUP SORT BY NOSORT | 1. 7. 54 (0) | 00:00:01 |
    | 4. TABLE ACCESS BY INDEX ROWID | BRI_RECON | 808 | 5656. 54 (0) | 00:00:01 |
    |* 5 | INDEX RANGE SCAN | BRI_RECON_IDX_EBC | 808 | 4 (0) | 00:00:01 |
    ----------------------------------------------------------------------------------------------------
    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------
    5 - access("BR".") ENTITY_BUDGET_CAT_ID "= 382)

    Richard Legge wrote:

    The void, select retrieve entity_budget_cat on where clause returns a single value.

    If I replace the subselect statement to get the entity_budget_cat with a literal value, it uses the index on ENTITY_BUDGET_CAT and is much faster with a much lower cost.

    Because the query runs faster when you use literal is because Oracle merges internal queries and views, so that it looks to below.

    Select Br ENTITY_BUDGET_CAT_ID as ENTITY_BUDGET_CAT

    sum (br. BRI_CREDIT) under the real name

    from: br bri_recon

    where br. ENTITY_BUDGET_CAT_ID =

    Group of BR. ENTITY_BUDGET_CAT_ID

    However when a subquery is used, as in the column ENTITY_BUDGET_CAT - the subquery must be run before the outer query can send more data, so that the outer query to only return results that match records based on the subquery.

    Richard Legge wrote:

    I need instruction in this format because its share actually well expand with unions comprising the sum of 4 tables, then later adds the value of the outer query to retrieve a single value by group of...

    Maybe you should re - write the query as follows so that the optimizer would get the opportunity to merge the view and give you better performance...

    Select entity_budget_cat

    , sum (actual) real by

    from (select br.entity_budget_cat_id as entity_budget_cat

    , sum (br.bri_credit) real by

    from: br bri_recon

    Br.entity_budget_cat_id group

    ) a1

    , (select ebc.id from entity_budget_cat where entity_id = 55 ebc) b1

    where a1.entity_budget_cat = b1.id

    A1.entity_budget_cat group;

    or just... would...

    Select entity_budget_cat_id entity_budget_cat

    , sum (actual) real by

    bri_recon a1

    , (select ebc.id from entity_budget_cat where entity_id = 55 ebc) b1

    where a1.entity_budget_cat_id = b1.id

    A1.entity_budget_cat_id group

  • Related table: space White/Page Question

    I have 2 Questions, they are two associated Table:

    1. in one of my document, an anchor of the Table starts on the new top of the Page, I don't know why (in the paragraph tag, is not defined for anywhere).

    Then the rest of the page is empty and begins on the next page, no Table should be displayed in the next line of the Table anchor?

    2. I also have another table that is several pages long. In this table, some lines are divided between pages (obviously because it is long several page table), however, the top on the Page row 2 (which is only 3 lines) could easily fit on 1 Page (which is half empty), but I don't know why FM8 and FM12 is splitting of lines in this way.

    Any answer will appreciated. Thank you.

    It's probably a combination of widows parameters and the orphans for the rows of the table, and maybe some settings to keep with lines that raises questions. The settings of the widows and the orphans are controlled in the table designer and for keeping with the settings are applied individually to the lines via the menu of Table Format > row suboptions.

  • table import DataPump, simple question

    Hello
    A junior DBA, I'm a bit confused.
    Suppose that a user wants to import a table with datapump which it exports from another database with different schemas and tablespaces (it has exported with expdp using tables = XX and I don't know the details..)...
    If I don't know the name of the table, should I ask these three questions 1) diagram 2) 3) version oracle tablespace?
    Of the documentation. I know the remapping of impdp capacities... But they are required when importing a table?
    Thanks in advance

    Hello

    Suppose that a user wants to import a table with datapump which it exports from another database with different schemas and tablespaces (He > exported with expdp using tables = XX and I don't know the details..)...
    If I don't know the name of the table, should I ask these three questions 1) diagram 2) 3) version oracle tablespace?

    You can get this information from the dumpfile if you want - just to make sure you get the right information. If you run your import command, but add:

    sqlFile = MySQL.SQL

    You can edit this sql file to see what is in the dumpfile. It won't display the data, but it will show all the metadata (tables, storage spaces, etc.). If you have not added sqlfile parameter is a .sql file that contains all the create statements that would have been executed.

    Of the documentation. I know the remapping of impdp capacities... But they are required when importing a table?
    Thanks in advance

    You must re-map anything, but if the dumpfile contains a table scott.emp then it will import this table scott.emp in. If you want to go in blake, then you must remap_schema. If it goes in the tablespace tbs1 and you want in tbs2, you need a remap_tablespace.

    Suppose that an end-user wants me to export a table spesific use datapump...
    Should I give him also the name of the repository where the exported table?

    It would be nice, but see above, you can get the name of the tablespace of sqlfile command during the import.

    I hope this helps.

    Dean

  • Table of contents problem/Question

    Hi everyone, I hope I can put my question precisely in words.

    I'm working on a product catalog 450 page in Indesign CS5 for mac.  The catalogue includes 7 main sections, in which there are several small sections. I need to create a table of contents for these small sections, however, my question is this;  my table of contents is based on product names I apply a paragraph style, but, also included on the same line as the name of the product, are several small icons.  I used the library function for the implementation of these icons.  I put my cursor where I wanted the icons to be, went to the library, do a right-click on the icon I wanted to and the article place selected.  I found this to be the easiest way since there were about 1500 products in the catalog.  So, my question is, now that I'm creating a mini-table of contents for these many sections, icons are included in my table of contents, that I don't want.  I can go and manually delete each icon, but I think there must be a quicker way.  I thought maybe a grep style, but may not know how to do this job.

    Any help would be appreciated!  It will take some time to remove each of the people.  I hope I described it accurately; Please do not hesitate to ask questions if there is not clear.

    Thank you very much!

    Annette

    After you create the table of contents, goto edit: click EDIT in find/replace: text: then arrow / markers / anchored object (sorry trying to remember from memory)

    G

  • Tables and AS3 loadVars

    I have a text file with variables and a swf that a friend made for me. Unfortunately I do not have the .fla file and I'm trying to recreate it.

    the file contains 3 variables with values, repeated 4 times and a final variable (called varDone), who tells him there is no more variables.

    The three variables are varImage, varURL, varText. They are used to load the images that can be clicked to open a Web site and they have a textfield above them.

    The flash is a banner that we use on our site to display these images. Somehow, it reads the first set of variables in a movieclip that I believe, where the image then fades and remains on the screen for more than 3 seconds and then the next image. It maintains variable file playback until it hits that varDone = 1 variable, then the banner starts everywhere. The file is such that I can add as many sets of variables as I want and it will display all, it could be 3, 10 or 30, as long as I have added a new set of (varImage, varURL, varText) to the variable varDone of the file. I thought maybe he could load these 3 variables in an array to a two dimension and then their treatment like that. This is the part that I don't know how to do, how to read each set of variables, until I get to the varDone = 1. I can do all the other stuff, I don't know how to read this file.

    It looks like the following:

    & varImage = http://www.MOFC-gaming.com/themes/CT_RN_GREYSCALE/images/spotlight1.jpg
    & varHeadline = RECRUITMENT, BAD COMPANY 2 MEMBERS
    & varLink = http://badcompany2.EA.com/#/home

    & varImage = http://www.MOFC-gaming.com/themes/CT_RN_GREYSCALE/images/Spotlight2.jpg
    & varHeadline = join MOFC in EVE Online
    & varLink = http://www.eveonline.com

    & varDone = 1

    XML is what you want.  You will get a table 1 d (not 2D - 2D not necessary at all).  An XML like this would be enough:

    Text to display as the Image could go here.

    Text to display as the Image could go here.

    Text to display as the Image could go here.

    Then, in Flash, you load the xml file and the resulting XML object that you get can be parsed like this:

    _xmlObject.image;<-returns an="" xmllist="" of="" all="" 'image'="" nodes="" in="" the="" xml="">

    _xmlObject.image [0];<-returns the="" first="" xml="" object="" found="" in="" the="" xmllist="" described="" above. ="" when="" treated="" as="" a="" string="" it="" will="" output="" "text="" to="" display="" along="" with="" image="" could="" go="">

    _xmlObject.image.@URL[0]<- returns="" the="" string="">

    This will teach you everything you need to know: http://www.kirupa.com/developer/flashcs3/using_xml_as3_pg1.htm

    I hope this helps.  For AS3, nothing but XML to load dynamic data.

  • name of table 2D element names questions

    Hello

    I'm working on this little code where I want to choose a sensor which will be released 3 axes. but I put the list from the selection of the sensor box 1 or multiple selection mode. Also, when I take more than one sensor I get 6 axes (3 for each sensor) in my scoreboard. My problem is that I want the list of these axes in a list box. but the list for the axis box is table 1 d and the node property item names table 1 d as well. My problem is the reference for the axis of the sensor are table 2D. How to remember?

    Help, please... A picture of the short code is provided

    Note to admin - attachment deleted by user request

    Remodel allows to edit your 2D in a 1 d table table.

  • Total N00b question

    Hi guys,.

    While I'm not new to coding, I'm new to Flash and all things related .

    I installed Flash Builder 4.5, The Air SDK and Simulator.

    Now when I want to start a new project I select 'file-> New-> Flex Mobile Project.

    Then I name the project and have an option to select the SDK. It is here where I'm a bit confused.

    Choose Flex 4.5? Or I might add, and then select the 'Blackberry Tablet OS 1.0.1 SDK"?

    I followed the installation instructions for the Blackberry SDK but the only SDK that shows is "Flex 4.5' but I can manually add the folder where is the Backberry SDK."

    Sorry if this is a stupid question... and thanks in advance.

    Cheers.

    As Colonel Winters said in the post above yours, make sure you only go into the properties of the project (right click on your project in the package on the left Explorer, click Properties). Expand Flex Build package, click on BlackBerry Tablet OS and check platform-specifc libraries add to library path. A picture is worth a thousand words, see screenshot.

  • Find the size of a table with partitions; Two questions

    DB version: 11.2.0.4

    Platform: Oracle Linux 6.4

    The slot table MH_PKT_HEADR in UTMSBL schema has more than 5000 partitions.

    Because there partitions, you cannot use just view DBA_SEGMENTS to determine the size of the table.

    So, I tried to use 2 SQLs mentioned below. Query1 returned 5 GB. But Query2 has returned a value zero. Query2 is actually a note metalink mentioned below, so he cannot deceive you, I guess.

    That is the reliable accurate query: Query1 or Query2?

    No idea why Query2 returns a Null value?

    - Query1

    fixed lines 200

    Col TABLE_NAME format a18

    with

    BaseData as)

    Select the owner

    nom_segment

    segment_type

    , round (sum (bytes) / 1024/1024/1024) GB

    sum (bytes) bytes

    count (*) segment_count

    of s dba_segments

    Group by owner, nom_segment, segment_type

    )

    ,

    LOB type as data)

    Select the owner

    table_name

    nom_segment

    of dba_lobs

    )

    ,

    all_segs like)

    Select coalesce (lobs.table_name, basedata.segment_name) table_name

    basedata.*

    of basedata

    left outer join

    type LOB data

    on (basedata.segment_name = lobs.segment_name

    and basedata.owner = lobs.owner)

    )

    Select table_name

    sum (bytes) bytes

    sum (gb) GB

    of all_segs

    where table_name = 'MH_PKT_HEADR'.

    and owner = 'UTMSBL. '

    Table_name group;

    TABLE_NAME BYTES GB

    ------------------ ---------- ----------

    5869469696 5 MH_PKT_HEADR

    - Request 2

    -Source: how to calculate the size of a Table that contains outline CLOB and BLOB (Doc ID 118531.1()

    SELECT

    (SELECT SUM (S.BYTES) - the Segment of Table size

    FROM DBA_SEGMENTS S

    WHERE S.OWNER = UPPER ('UTMSBL') AND

    (S.SEGMENT_NAME = UPPER ('MH_PKT_HEADR'))) +

    (SELECT SUM (S.BYTES) - the size of the Lob Segment

    FROM DBA_SEGMENTS S, DBA_LOBS L

    WHERE S.OWNER = UPPER ('UTMSBL') AND

    (L.SEGMENT_NAME = S.SEGMENT_NAME AND L.TABLE_NAME = UPPER('MH_PKT_HEADR') AND L.OWNER = UPPER('UTMSBL'))) +

    (SELECT SUM (S.BYTES) - the size of the Lob Index

    FROM DBA_SEGMENTS S, DBA_INDEXES I

    WHERE S.OWNER = UPPER ('UTMSBL') AND

    (I.INDEX_NAME = S.SEGMENT_NAME AND I.TABLE_NAME = UPPER('MH_PKT_HEADR') AND INDEX_TYPE = 'LOB' AND I.OWNER = UPPER('UTMSBL')))

    "TOTAL TABLE SIZE.

    FROM DUAL;

    TOTAL TABLE SIZE

    ----------------

    SELECT

    (SELECT nvl (SUM (S.BYTES), 0)-dimensions of the Segment Table)

    FROM DBA_SEGMENTS S

    WHERE S.OWNER = UPPER ('UTMSBL') AND

    (S.SEGMENT_NAME = UPPER ('MH_PKT_HEADR'))) +

    (SELECT nvl (SUM (S.BYTES), 0)-Segment Lob size)

    FROM DBA_SEGMENTS S, DBA_LOBS L

    WHERE S.OWNER = UPPER ('UTMSBL') AND

    (L.SEGMENT_NAME = S.SEGMENT_NAME AND L.TABLE_NAME = UPPER('MH_PKT_HEADR') AND L.OWNER = UPPER('UTMSBL'))) +

    (SELECT nvl (SUM (S.BYTES), 0)-size of the Lob Index)

    FROM DBA_SEGMENTS S, DBA_INDEXES I

    WHERE S.OWNER = UPPER ('UTMSBL') AND

    (I.INDEX_NAME = S.SEGMENT_NAME AND I.TABLE_NAME = UPPER('MH_PKT_HEADR') AND INDEX_TYPE = 'LOB' AND I.OWNER = UPPER('UTMSBL')))

    "TOTAL TABLE SIZE.

    FROM DUAL;

    David Fitzjarrell

  • First Pro N00b question about nested frameworks, I just can't google.

    I have two clips, one nested inside the other. The 'outside' (this shows how n00b I am, I'm sure there's a term better than this) is now displaying a frame I want to change. I open the nested (or) sequence, and it's on a different image. This framework is very hard to find. How do I automatically select two tabs?

    Nevermind guys, I thought about it. You'll probably laugh, but it seems that it does not count as 'opening' a sequence of nested at least that I've "shut, her" first. An already open opening sequence he can't frame. (Maybe a feature useful to add?)

  • How do I search a Movieclip given stage and then add all instances of it in a table? AS3

    I would like to add multiple instances of a Movieclip, (name of the library = bats | instance name = none), inside an another Movieclip (name of the instance = back.visuals) / / (by HAND) NOT addChild (mc_name); Easy

    If someone could help me with the code to perform the following steps:

    Search the Movieclip, (name of the instance = back.visuals), which contains the Movieclips, (= bats library name: instance name = none), added manually to the scene at hand.

    Then, for all instances of this movieclip (= bats library name: instance name = none) add them to a table.

    Thank you

    Dyami

    Assuming that you are talking about DURATION, if you export a symbol of action script, give it a class name you can always read if the child of an object is an instance of that symbol.

    Say, if the name of the symbol is bats you can identify it in the loop as follows:

    var enemyList:Array = [];
    for (var i:int = 0; i < back.visuals.numChildren; i++)
    {
              var child:DisplayObject = back.visuals.getChildAt(i);
              if (child is Bats)
              {
                        enemyList.push(child);
              }
    }
    
  • AS3 syntax question

    Hello

    Having a problem or issue of syntax. When I'm writing this in AS3, I get the right result: 4

    var wordArray1:Array = ['test', 'Apple', 'orange', 'olive'];

    var theLevel:Number = 1;

    trace (root ["wordArray" + likethis] .length);

    but when I write it in this way, inside a function, I get an error:

    function test (): void

    {

    var wordArray1:Array = ['test', 'Apple', 'orange', 'olive'];

    var theLevel:Number = 1;

    trace (root ["wordArray" + likethis] .length);

    }

    test();

    I don't understand what I am doing wrong? Any ideas?

    in the second case, wordArrays scope is limited to the function.

    so when you try to address wordArray with root.wordArray, the main timeline is unclear on this issue.

    simple solution: declare it outside the function.

    var wordArray1:Array;

    function test (): void

    {

    wordArray1 = ['test', 'Apple', 'orange', 'olive'];

    var theLevel:Number = 1;

    trace (root ["wordArray" + likethis] .length);

    }

    test();

  • AS3 button Question

    Hey all,.


    My problem is this: I have a flash file in which I add MovieClips dynamically as buttons using a loop for. At each iteration, I add a new button, give it a name and add an event listener. My question is, with this method, how do I not know what button was clicked? In other words, say my for loop runs 5 times, adding 5 different buttons in 5 different places on the stage. Anyway is to leave in the code to determine which button has been activated? I feel like there should be a simple way to figure it out and I just lack.


    The code looks like this:


    for {(var aCount:String in pNameArray)


    This ["btn" + m1Count] = new buttonMC();


    This ["btn" + m1Count] .addEventListener (MouseEvent.MOUSE_OVER, select);

    This ["btn" + m1Count] .addEventListener (MouseEvent.MOUSE_OUT, leave);

    This ["btn" + m1Count] .addEventListener (MouseEvent.CLICK, goTo);

    This ["btn" + m1Count] .buttonMode = true;

    This ["btn" m1Count] .name plus 'btn' + m1Count;


    addChild (this ["btn" + m1Count]);

    function goTo(e:MouseEvent):void {}

    Code.

    }

    }


    Any advice or ideas would be greatly appreciated. Thank you.

    Don't include this feature inside the loop.

    The argument passed to the function can be used to identify the button that was clicked.  Given that you have assigned a name to the button property, you can make use of that.

    function goTo(e:MouseEvent):void {}

    trace (e.currentTarget.Name);

    }

Maybe you are looking for

  • can't comment on a blog that has an embedded comment form

    I can't comment on a blog that has a form of commentary incorporated; for example, www.blogger.com and www.blogspot.com. Apparently, this has been a problem between Firefox and Google for over a year with no final resolution.

  • MacBook Air does not recognize my HP7510 Via Airprint printer!

    I have a 13 "MacBook Air connected wireless to my HP7510 all-in-One via Airprint. It worked perfectly until I moved house but since I was in my new House (same router but new ' phone number) connection is very random.  Sometimes it works, then it sto

  • registration of ip addresses and usernames of routers

    Hello Without AAA services, using the class-"refuse any newspaper" unde access, I can connect attempts trying to telnet to the router IP addresses. Can I connect also down the user name the user name successful without using a GANYMEDE + or RADIUS se

  • Battery failed - PE2950 [MS]

    Buongiorno. We have a server mod PE2950, serial number , cui he led, usually azzurro stamattina e giallo. Ho avviato it Modular Disk Storage Manager e mi tell a problema di batteria sul software raid controller. By convenience allégo uno screenshot d

  • collections of different number of the sum of the books picture books

    Using of Lightroom CC (3.4 GHz i7-4770) with an Intel PC processor with 32 GB of memory and plenty of storage.  The total number of images on the line 'Collections of books' (998) does not match the content of the 3 books (aka 420).  Why?