Multiple MovieClips with same instance name

I'm following a tower defence tutorial and part of the code is set up so I can build towers on the "grass" movie clip. I wanted to add more patches of "grass" and gave them all the same instance name so I can be able to place towers on them, but I have the problem that I can only place towers on the first item I placed and has the instance name of "grass". I can't seem to place towers on the other patches of grass.
I removed the instance name of the first patch of grass and it let me build towers on the second patch, but the second patch only.
I was following this tutorial: http://www.goofballgames.com/2010/01/31/how-to-build-a-tower-defense-f lash-game-part-2-placing-towers/
Here is the code for it I believe:
onClipEvent (load)
    active = 0;
onClipEvent (enterFrame)
    if (active == 1)
        setProperty("", _x, int((_root._xmouse - 10) / 20) * 20 + 20);
        setProperty("", _y, int((_root._ymouse - 10) / 20) * 20 + 20);
  hitTestOnGrassMovieClip = _root.grass.hitTest(_x, _y, 1);
        if (hitTestOnGrassMovieClip) {
            gotoAndStop(1);
   _root.ranger.gotoAndStop(1);
        else {
            gotoAndStop(2);
   _root.ranger.gotoAndStop(2);
        _root.ranger._x = _x;
        _root.ranger._y = _y;
        _root.ranger._width = _root["tower_" + tower].range * 2;
        _root.ranger._height = _root["tower_" + tower].range * 2;
on (press)
hitTestOnGrassMovieClip = _root.grass.hitTest(_x, _y, 1);
hitTestOnDeSelectMovieClip = _root.deselect.hitTest(_x, _y, 1);
    if (hitTestOnGrassMovieClip || hitTestOnDeSelectMovieClip) {
        if (hitTestOnGrassMovieClip) {
   ++_root.towerCount;
   _root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 500 + _root.towerCount);
   a = _root["t" + _root.towerCount];
   a._x = _x;
   a._y = _y;
   a.active = 1;
  active = 0;
  setProperty("", _x, 1000);
  _root.selectedTower = "";
  _root.ranger._x = 1000;
  _root.ranger._width = 10;
  _root.ranger._height = 10; 
}

1.  You cannot use the same instance names for different objects and expect more than one to be targeted.  You need to assign unique names, or you can store references to them in an array and use the array to target them.
2. You are posting AS2 code in the AS3 forum.  You should repost in the AS2 forum.  http://forums.adobe.com/community/flash/flash_actionscript

Similar Messages

  • Multiple Infoobject with same technical name

    Hi All,
    I have a very basic question which confuses me a lot.
    I have installed a BI content info cube 0SD_C03(Sales overview) and it is installed in Info Area -  ERP Analytics -->sales and distribution analyses. I checked the dimensions of it and 0customer( master data attr) is linked as a dimension. I created a copy of 0SD_C03 and the new Infocube name is ZSD_C03_T. It also has the same 0customer master data attr as a dimension(obviously!).
    Now both the infocubes have different technical name(0SD_C03 and ZSD_C03_T) since they will be storing different sets of data(lets say). but the technical name of the master data (0CUSTOMER) is the same for both cubes.
    ques 1: Is it since its a master data and contains the same set of master data for both the cubes, it has the same technical name?
    If I search the Info provider section for "0CUSTOMER", i get two entries: One within my info area and another within another info area. And also i can keep doing (Right click Info area--> Insert Characteristic as Infoprovider) on every other info area and insert 0CUSTOMER in every other info area.
    ques 2: does all the 0CUSTOMER in different info areas, actually contain the same set of data?
    ques 3: if i search for 0CUSTOMER in InfoObjects section, i get 5 entries in different infoareas. How can there  be diffferent Infoobject with same technical name be present in different info areas?
    Sorry if i am too elaborate, I hope i have made my questions clear.

    Hi,
    ques 1: Is it since its a master data and contains the same set of master data for both the cubes, it has the same technical name?
    A. same 0CUSTMER you can use the different places it holds same data.
        source is the 0CUST_ATTR -> target is 0CUSTOMER.
    ques 2: does all the 0CUSTOMER in different info areas, actually contain the same set of data?
    A. it will contain the same set of data.
        it has the overwrite function.
    ques 3: if i search for 0CUSTOMER in InfoObjects section, i get 5 entries in different infoareas. How can there  be diffferent Infoobject with same technical name be present in different info areas?
    A. you triggered the 5 times for specif DTP means you will 5 entries for different info areas.
    finally i will say you use the 0CUSTOMER no of places where you required and no need to create the ZCUSTOMER.
    Thanks,
    Phani.

  • Multiple Accounts With Same Display Name Lync 2013

    Hi All,
    I have a single user in my Lync 2013 environment that sees three different users with the same exact display name. All three users have a different SIP address.
    User1 - Melissa A. - [email protected]
    User2 - Melissa A. - [email protected]
    User3 - Melissa A. - [email protected]
    Upon looking at the contact card, each user has the same display name but correct email address. However there is another email address line that appears underneath the original Send Email address line - on other computer's this appears as "IM".
    The user is running a Windows Server 2012 Standard on a Hyper-V Virtual Machine. I've tried re-installing the Office 2013 suite as well as forcing an Global Address Book update from his local machine. All data is correct in Lync Server and Active Directory.
    Can someone please advise? Could it be a corrupt database?
    Thanks in advance,
    Adrian

    Hi Adrian,
    You could try deleting the following data for the user.
    1.  User profile:
    %userprofile%\AppData\Local\Microsoft\Office\15.0\Lync\[email protected]
    2. Registry Key:
    HKCU\Software\Microsoft\Office\15.0\Lync\[email protected]
    3. Outlook Contact
    Delete the related Contact Cards in Outlook
    Hope it can be helpful.
    Best regards,
    Eric

  • Multiple movieclips with same export for AS names? Possible?

    Ls,
    Im working on an app for mobile devices.
    Since the demensions of some of them, i.e. phones as opposed to tablets, have a much smaller screen, wanted to use different sets of mc's depending on screen size (device dimension wise, not resolution).
    So a smaller device would use the mc's with larger gfx so they would still be decipherable and the larger devices could use smaller gfx so to be abale to get a larger part on the screen at the same time
    - I could just scale the entire screen clip all the time, but this will slow it down too much i think
    - I could create multiple instances and use different names and then sort them out run time in AS, but this would also steal processor time. Im not really for that.
    - I could publish multiple versions, depending on device its for. But this would require me to maintain multiple sources on upgrades. I can feel the hurt already.
    I was hoping it is possible somehow to export the movieclips as .swf's or something and then sorting out run time wich one to import/use/load.
    Then, hopefully i can refer to them in my code with the same name's but they will be different sizes depending on wich i had chosen to include/load.
    Makes any sense?
    Any info on what's the best way to proceed is highly appreaciated.
    Regards,
    Mac

    Kglad,
    I'm not sure I understand what you mean.
    I meant: if I use as object creation with as like
    mc:movieclip = new someclip();
    It had the dimensions it has in the library.
    If I then do a
    mc.scaleX = mc.scaleY = .75;
    It wil change size yes.
    But wont this require flash to internally resize it each time it has to paste it onto the screen/ into the canvasbitmap?
    Or does it take a snapshot from the Library and use that until te next scale operation?
    The reason i ask is because a: i dont know ****, b: if i resize it really small, then resize it large, it seems unaffected by the first resize to small.
    So i''m thinking it still uses the same mc source, and rescales it from that all the time.
    Wich would afcourse affect performance.
    Highest regards,
    Mac

  • Multiple AD with same unique name

    Our requirement is configure 2 AD servers with GRC ( version 10). But the tricky part is around 300 users in both the domians are same. ef.
    Domain  \ User name
    NBC \ test
    PBS \ test
    Now I have to integrate these 2 domains in ABAP.  My problem is once I hook NBC AD it will create test and if I hook up PBS it will not create test.  But I need that too.  (may be I want pass say test1 instead of test) Can this be doable?  How?
    Kedar

    Our requirement is...
    Yep, had this requirement as well.
    All these various user name collisions and worse is different IDs for the same person can be solved relatively easily by IdM.
    But best practice is still to remove the collisions and use unique IDs. Same goes for deleting users (dont do it).
    Good luck.
    Cheers,
    Julius

  • Update multiple fields with same/diffrent name

    I have the form is displayed  order no, message and sent_date. Mesage and Date sent are editable.  I can change value from both colums in diffrent values then hit submit for update.  My code below is loop thur message and date sent field then update them based on the pk ID.  Unfortunately, it didn't work as the expected.  Can you please help?
    Oder NO
    Message
    Date Sent
    5463
    first message
    12-10-12
    5463
    second message
    10-13-12
    <cfset myIds = ArrayNew(1)>
    <cfform name="update" method="post">
    <cfloop query="qMesg">
       <cfscript>
            ArrayAppend(myIds, "#id#");
            </cfscript>
         <cfinput type="text" value="#mesg#" name="mesg">
         <cfinput type="text" value="#dateformat(sent_date, 'mm-dd-yy')#" name="sent_date" validate="date" />
         <cfinput type="submit" name="submit" value="Update">
    </cfloop>
      <cfset myIdsList = #ArrayToList(myIds, ",")#>
       <cfinput type="hidden" name="ids" value="#myIdsList#">
    </cfform>
    <!---update--->
    <cfif isDefined("form.submit")>
    <cfloop index="idIdx" list="#newsids#" delimiters=",">
    <cfloop list="#form.mesg#" index="x">
    <cfloop list="#form.sent_date#" index="y">
          update [tblMessg]
         set mesg = <cfqueryparam value="#x#" cfsqltype="cf_sql_varchar">,
               sent_date = <cfqueryparam value="#y#" cfsqltype="cf_sql_date">
       where id = <cfqueryparam value="#idIdx#" cfsqltype="cf_sql_integer">
      </cfloop>
    </cfloop>
    </cfloop>
    </cfif>

    I am with Dan on this (identifying the field names with IDs), but prefer cfloop to cfoutput within cfform. Furthermore, I would put the submit button outside the loop.
    <cfloop query="qMesg">
        <cfscript>
        ArrayAppend(myIds, "#id#");
        </cfscript>
        <cfinput type="text" value="#mesg#" name="mesg#id#">
        <cfinput type="text" value="#dateformat(sent_date, 'mm-dd-yy')#" name="sent_date#id#" validate="date" />
    </cfloop>
    <cfinput type="submit" name="submit" value="Update">
    With proper handling, one loop should be sufficient on the action page.
    <cfloop index="idIdx" list="#form.ids#" delimiters=",">
        <cfset current_message = form["mesg" & idIdx]>
        <cfset current_date_sent = form["sent_date" & idIdx]>
        <cfquery>
        UPDATE tblMessg
        SET mesg = <cfqueryparam value="#current_message#" cfsqltype="cf_sql_varchar">,
        sent_date = <cfqueryparam value="#current_date_sent#" cfsqltype="cf_sql_date">
        WHERE id = <cfqueryparam value="#idIdx#" cfsqltype="cf_sql_integer">
        </cfquery>
    </cfloop>

  • Multiple members with same alias

    I have multiple members with same alias name. Are there anyway to build dimension members with same alias name?

    Typically I will concatinate the member name (as either a prefix or suffix ) to the Alias to make it unique

  • Adressing multiple copies of Movieclips with the same instance name

    Is it possible to iterate through MV copies with the same instance name? It would be very useful for my project.

    you can copy movieclips with the same instance name but you'll only be able to easily control (with actionscript) the last created instance.  the rest will be difficult to reference.
    although, if the only movieclips attached to the parent are the ones you are interested in and you want to do that same thing to all of them (say rotate them all), you can do that without giving them distinct names.

  • MC placed multiple times and given same instance name?

    Hi everyone, I am pretty new to code in flash.
    I am mostly used to use object oriented programming, but in flash I'm doing everything in one frame.
    I am making a car game. Kinda GTA style, but very simple. You are a police car, and you chase a theif through a city.
    The theif uses ground nodes to know where he can drive, and where he can turn.
    basically, below is the stage. I have placed these objects directly onto the stage, and given some of them instance names.:
    |      O
    |  O ©
    |            _______________________
    |            |
    |            |
    |            |
    |            |
    |      ^     |
    |      |     |
    |     X     |
    The © is a MC named node_switch.
    The O's are the two objects of the same MC, which both are named node_stop
    The X is the theif (mc), and he is driving upward along the road.
    When theif hits node_switch, he will look up,down, left and right if any node_stop is placed.
    This is done with hitTestObject. the theif has invisible "beams" in all 4 directions, inside it's MC.
    The problem is as following:
    When multiple nodes are placed on the stage, the theif only collides with one of them.
    As I said, they have the same instance name.
    Is there a way to be able to place them directly on the stage, give them all the same instance name, and make a for loop where it goes through all of them and checks collision?
    Edit:
    Or is it maybe possible to place them directly on the stage, give them instance names such as "node_switch01", "node_switch02", and then check for them all at the same time in a for loop, or in some other way? there will be lots of nodes, so...

    If you name them all differently you will have an easier time of it.  To loop thru them with the naming convention you suggested you can use the bracket notation, though it would be easier to get rid of the leading zeroes...
    for (var i:uint=1; i<=numNodes; i++){
         if(thief.hitTestObject(this["node_switch"+String(i)]){
              // don't go this way

  • To create multiple files with same content but with different names

    Hi SapAll.
    here i have got a tricky situation on Idoc to File Scenario.
    in my interface of an Idoc to file ,there  is requirement to create multiple files with different file names but with same content based on one Idoc Segment.
    which means there will be one Zsegment with two fields in the idoc,where one field with (content refers to the name which file name should start with .so lets say if this segment is repeated for 3 times then PI should create 3 files in the same directory with same content but with different file names (from the filed).
    so here for now iam using one reciever file communication channel.
    can any body give me the quick answer.
    regards.
    Varma

    What do you mean by different names?
    when i make proper setting in the Receiver Channel....on how to create the filename (what to append) like add Timestamp, counter, date, messageid.....even in this case you will ahve file with different names and that too from same File channel.
    You can perform multi-mapping in XI/ PI and then your File channel will place the files in the target folder with relevant names. You cannot use Dynamic Configuration with Multi-Mapping!
    If you intend to use different File channels, then do the configuration as required (normal)...even over here you can follow multi-mapping.
    Do not use a BPM!
    Regards,
    Abhishek.

  • Mounting multiple directories with same name on different severs to a single mount point on another server

    We have a requirement where in we have multiple solaris servers and each solaris server has a directory with the same name.
    The files in these directories will be different.
    These same name directories on multiple severs has to be mounted to a single directory on another sever.
    We are planning to use NFS, but it seems we can not mount multiple directories with same name on different severs to a single mount point using NFS, and we need to create multiple mount points.
    Is there any way we can achieve this so that all the directories can be mounted to a single mount point?

    You can try to mount all these mount points via NFS in one additional server and then export this new tree again via NFS to all your servers.
    No sure if this works. If this works, then you will have in this case just an additional level in the tree.

  • Using multiple SSIDs with same name but different PSKs

    I have a central WLC 2504 controller that is being used for remote site FlexConnect 1141 APs. They all advertise three different SSIDs. One SSID is a global SSID that is the same at every office. One is a hidden SSID using 802.1x machine auth.
    The one I am trying to get working is the local office guest network. These SSIDs are all the same at each office but should have different PSKs. They are local to the office, therefore would only ever be applied to a specific FlexConnect group.
    I understand why in theory this is generally not a good idea but given these are for remote sites I'd like it to be possible. I always get this message though:
    "WLAN with duplicate SSID and L2 security policy found"
    Is there a way around this? New WLC code that allows it maybe?

    I was able to configure three (more I think possible) WLANs with same SSID name and all are WPA2-AES-PSK on the same WLC and all are enabled at hte same time.
    Note that you can not have any of those broadcasting on same AP group. Each WLAN can be only broadcasted on a separate AP group. For your sites, It will probably need you to define an AP group for each site to broadcast different WLANs on different sites.
    You can do that if all your WLANs have an ID of 17 or higher. (the reason is, WLANs of 1-16 are by default broadcasted on the default AP group. and because those can not be on the same AP group - including the default one - then you can't have them with WLAN IDs 1-16. i.e on same - default - AP group)
    HTH
    Amjad
    rating useful replies is more useful than saying "Thank you"

  • Multiple accounts with same email can't acces original account

    ok, so i created a new skype. I was messing with skype account on my desktop and wound up unlinking and re linking the account basically i made 2 extra accounts and they have my live: random.namehere_1 and live: random.namehere_2 and i cant log into my original one anymore also when i try to do a recovery it says i have 2-3 skype accounts on my email and i cant log into my accounts by typing in the live:random.namehere and the  password it just says ooops something went wrong basicallly saying the pw and account name are wrong when they arent i made sure of it. so how do i eliminate the cloned accounts and log into the main one.  

    Actually this morning I was able to log on the account from an iPad with no fuss but the pc refuses to sign in^^^!???! "Skype couldn't connect" - What is going on???
    I also found out that I could sign in via a browser but not via skype program... So I uninstalled it and installed it again and it's working now...
    I have now changed the email so I don't have 3 accounts with the same primary email as Skype seems to not being able to handle multiple accounts with same email!!!

  • How To Create Table View With Same Column name But Different Table?

    Hi All,
    I have the problem to create a tableview with same column name but in different table.
    The Table that i have:-
    Table - PAC051MPROFORMA
    Column - mrn,visitid
    Table - PAC051TPROFORMA
    Column - mrn,visitid
    Table - PAC052MTRANSBILL
    Column - mrn,visitid
    Then i want to create a table view to view that table. This is my SQL
    CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid)
    As Select PAC051MPROFORMA.mrn,PAC051MPROFORMA.visitid,PAC051TPROFORMA.mrn,PAC051TPROFORMA.visitid,PAC052MTRANSBILL.mrn,PAC052MTRANSBILL.visitid
    where
    *(a.PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)*
    and
    *(a.PAC051TPROFORMA.mrn=PAC052TRANSBILL.mrn)*
    That SQL Return this error = ORA-00957: duplicate column name
    Then I modify that SQL to
    CREATE VIEW pacviewproforma (mrn,visitid)
    As Select PAC051MPROFORMA.mrn,PAC051MPROFORMA.visitid,PAC051TPROFORMA.mrn,PAC051TPROFORMA.visitid,PAC052MTRANSBILL.mrn,PAC052MTRANSBILL.visitid
    where
    *(a.PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)*
    and
    *(a.PAC051TPROFORMA.mrn=PAC052TRANSBILL.mrn)*
    This time this error return = ORA-01730: invalid number of column names specified
    What should i do?
    Thanks...

    Hi,
    SQL> CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid)
      2  As Select
      3  PAC051MPROFORMA.mrn,
      4  PAC051MPROFORMA.visitid,
      5  PAC051TPROFORMA.mrn,
      6  PAC051TPROFORMA.visitid,
      7  PAC052MTRANSBILL.mrn,
      8  PAC052MTRANSBILL.visitid
      9  from PAC051MPROFORMA,PAC051TPROFORMA,PAC052MTRANSBILL
    10  where
    11  (PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)
    12  and
    13  (PAC051TPROFORMA.mrn=PAC052MTRANSBILL.mrn);
    CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid)
    ERROR at line 1:
    ORA-00957: duplicate column namePlease give different names to each column.
    Something like this..
    SQL> CREATE OR REPLACE VIEW pacviewproforma (MPROFORMA_mrn,MPROFORMA_visitid,TPROFORMA_mrn,TPROFORMA
    _visitid,MTRANSBILL_mrn,MTRANSBILL_visitid)
      2  As Select
      3  PAC051MPROFORMA.mrn,
      4  PAC051MPROFORMA.visitid,
      5  PAC051TPROFORMA.mrn,
      6  PAC051TPROFORMA.visitid,
      7  PAC052MTRANSBILL.mrn,
      8  PAC052MTRANSBILL.visitid
      9  from PAC051MPROFORMA,PAC051TPROFORMA,PAC052MTRANSBILL
    10  where
    11  (PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)
    12  and
    13  (PAC051TPROFORMA.mrn=PAC052MTRANSBILL.mrn);
    View created.
    SQL> DESC  pacviewproforma;
    Name                                      Null?    Type
    MPROFORMA_MRN                                      NUMBER
    MPROFORMA_VISITID                                  NUMBER
    TPROFORMA_MRN                                      NUMBER
    TPROFORMA_VISITID                                  NUMBER
    MTRANSBILL_MRN                                     NUMBER
    MTRANSBILL_VISITID                                 NUMBER
    ORA-01730: invalid number of column names specifiedThe list of column nmae you specified during the CREATE VIEW should match with the SELECT list of the view.
    Twinkle

  • Read multiples files with same extension

    how to read multiples files with same extension in java.
    for ex : i would like to read all .DAT files from C drive using java.
    How is it done

    - You create the filter
    - You get the list of files
    - You open and read each file.
    For the first two above you look at java.io.File and listFiles(FileFilter filter).
    For the third you find whatever input stream is appropriate from java.io.*

Maybe you are looking for

  • Bring loaded external swf to the front

    Hi, I am now implementing to create a website using side scrolling platform game approach. Since the player/actor (character that moves according to keyborad events) should always be at the top layer, I am having difficulties to get my loaded swf on

  • Document numbering issue - Incorrect documents opening from Reports

    We follow repetitive document numbering with different series name. During a customised report generation, the details displayed in the report are correct, but when I click on the document number from the report, it opens a different document with th

  • Notification in 9.0.2

    Hi all, Has any of you configuration fine the new Notification system in iASWE 9.0.2? I read the docs but it's not enough. Thanks in advance. Regards.

  • IWeb site from second Mac

    I have been messing about building another IWeb site on my old G4. If I rename the domain can I just transfer the second domain onto my iMac and run both sites from there. If so how will I be able to open them individually Mike

  • Mail Migration - Folders Subscriptions & Unread Mail

    Hello, I'm currently testing a migration from MS 5.2 to 6.2. Sorry for all the verbage here - I'll try to shorten as much as possible. iPlanet Messaging Server 5.2 HotFix 2.09 (built Nov 18 2005) libimta.so 5.2 HotFix 2.09 (built 10:35:58, Nov 18 200