How do you share size properies from one object to another?

Hi guys,
I've currently coding my own shoot 'em up game where if enemy is killed,  enemy turns to a block. I want to set it up so the size properies will  pass over to the block (same object size - height and scale) but also  changing the collision properies so the player will be enable push the  block around the screen but I'm not sure how to implement such  functionality/feature. I've experimented with two ways so far;
1.) The enemy changes to a frame of a block when he dies (illusion of a  different object but the same object with a different frame on the  timeline) using the same size properies but I can't seem to the change  the collision properies from it's prior setting of causing damage and  re-bound/bounce to the player.
2.) The enemy is removed completely from the game and a new block object  is added in the same position where enemy died but I can't share/code  the same size properies to this new block object making obvious that is a  different object.
Here is a code I've what I've done so far (which is attempting to do first approach);
Code:
function onEnterFrame(event:Event):void
Collision.block(player, enemy);
function checkCollisionWithEnemies(bullet:MovieClip)
if (enemy.hitTestPoint(bullet.x, bullet.y,true))
     if (player.char_type == 1)
       enemy.meter.width -= 10;/// Damaging enemy
       enemy.gotoAndStop(2);
       removeChild(bullet);
       bullet = null;
        if (enemy.meter.width < 1)  //// Dead enemy
     enemy.stop();
     enemy.gotoAndStop(3); /// enemy goes to block frame
     enemy.enemy_char_type = 3; /// enemy becomes block
         if (enemy.enemy_char_type == 3)
         trace ("Hello");
         Collision.block(enemy, player); /// Trying to change collision settings
Any suggestions/help would be greatly appreciated.
Thanks
Jonesy

Hi kglad again,
thanks for all your input and support so far, you're been very helpful. Using your code as reference, I either occur a 1046 error - "Type was not found or was not a compile-time constant: DisplayObject" or the new code added doesn't seem to function at all.  I've been puzzling over this all day, seeking for a solution, I was wondering if you point me in the right direction but anyhow here below are my two attempts -
This 1st code attempt below leads to: a 1046 error - "Type was not found or was not a compile-time constant: DisplayObject"
<code>
function checkCollisionWithEnemies(bullet:MovieClip)
             var block:Block = new Block();
             block.x = enemy.x;
               block.y = enemy.y;
         if (enemy.meter.width < 1)
                        enemy.stop();
                        swapProperies(enemy,block);
                        removeChild(enemy);
                        enemy = null;
                        addChild(block);
                       _tweenX.removeEventListener(TweenEvent.MOTION_FINISH, onMotionFinishX);
                       _tweenY.removeEventListener(TweenEvent.MOTION_FINISH, onMotionFinishY);   
function swapProperies(dobj1:DisplayObject, dobj2:DisplayObject):void
           var propertyA:Array=["x","y","width","height","rotation"]
            for(var i:int = 0; 1>propertyA.length;i++)
            dobj2[propertyA[i]] = obj1[propertyA[i]];
</code>
I imported a new class "import flash.display.Object;" to the package to confirm/declare the DisplayObject, but remains to display the same error message.
2nd attempt - This is where I thought I would directly apply the code to the enemy and block: MovieClips like other objects in the rest of the code, but this attempt leads this new code not to function at all but able to compile/play the game without any errors, I only changed the function swapProperies (the rest of the code is the same) -
<code>
function swapProperies(enemy:MovieClip, block:MovieClip):void
           var propertyA:Array=["x","y","width","height","rotation"]
            for(var i:int = 0; 1>propertyA.length;i++)
            enemy[propertyA[i]] = block[propertyA[i]];
</code>
Any suggestions?
Thanks
Jonesy 

Similar Messages

  • How do you transfer Apple IDs from one ipad to another iPad?  I got the new ipad and gave my ipad 2 to my wife who had the first version and now I can't get my Apple ID off so she can use her Apple ID.

    how do you transfer Apple IDs from one ipad to another iPad?  I got the new ipad and gave my ipad 2 to my wife who had the first version and now I can't get my Apple ID off so she can use her Apple ID.

    You don't transfer Apple ID's from one device to another one. You sign out in the settings, )the App Store and iTunes if necessary) and then sign in with the other ID.
    Settings>iTunes & App Stores>Apple ID>Sign out. Them sign in with the other ID. You can sign out of the app store and iTunes as well by going to the featured Atab in the App Store and the music tab in iTunes, swipe to the bottom and access the Apple ID in there.
    You should have erased the iOad before you gave it to her in Settings>General>Reset>Erase all content and settings. That way she could set up the iPad as new with her own Apple ID.
    Be aware of the fact that if you use each others ID's in order to download past purchased content to your own iPads, you will lock yourself out of your own ID as you will have associated your iPad with the other person's Apple ID.
    In other words, if you sign into your wife's ID on your iPad so that you can download an app or an album so that you don't have to pay for it again, you will lock yourself out of your Apple ID for 90 days.

  • How do you transfer digital booklets from one PC to another PC?

    how do you transfer digital booklets from one PC to another PC?

    Hi Purple Cow,
    Welcome to Apple Discussions.
    The following User Tip will guide you through the procedure step by step:
    http://discussions.apple.com/thread.jspa?threadID=121751
    If you have further questions regarding iTunes for Windows you're better off posting the question in the iTunes for Windows forum which can be found here:
    http://discussions.apple.com/category.jspa?categoryID=150
    Simply pick an appropriate forum from the "Forum/Category" section and post your question.
    Good luck.
    RD

  • How do you get all downloads from one computer to another

    How do I get everything on iTunes from one computer to another?

    You've posted to the iTunes Match forum, which your question isn't really related to. However this KB article will help:<http://support.apple.com/kb/HT4527>.

  • How do you pass vi references from one event to another

    I have a vi which gets vi references (thereby loading the vi's into memory) for all the vi's in a given directory when a user clicks a button on the front panel. To do this I use an event structure. My question is whether it is possible to have another event (user button on the front panel) which unloads the vi's from memory. I have tried passing the vi references that are initially generated to the close reference function but whenever I do I get a 'vi reference invalid' error. Does this have to do with trying to pass the vi references between one event and another? If I use a local variable simply pass a reference to another indicator and then probe it, the originally-generated refnum and the local vari
    able refnum match up. However once I try to wire that same indicator to the close reference function I get the 'vi reference invalid' error. Is there a different/better way to unload the vi's from memory based on a user button click? Any suggestions would be welcome.
    Jason
    Attachments:
    Load_Directory_of_vi's.vi ‏57 KB

    Several problems with your code:
    1... Bad idea to use lights as buttons. Yes it can be done, but it's not "natural".
    2... If you've gotta do that, set their mechanical action to "LATCH WHEN RELEASED"
    3... Because of #2, you are getting TWO copies of every array when you click the LOAD VIs light (er... button).
    4... No need for the conversion from path to string and back - use BUILD PATH to append each file name to he folder path.
    5... Set the BROWSE OPTIONS on your PATH control to EXISTING DIRECTORY to allow browsing of directories, not files.
    6... Your code doesn't care whether the file is a .VI file, or a .ZIP file, or a .TXT file, or what. Use the PATTERN input on the LIST function to discriminate.
    7... Your code is only storing the latest refer
    ence, not the array of references.
    8... An ERROR DIALOG on the OPEN REFERENCE function will tell you that you're getting an error. Why? You are asking to prepare a non-reentrant VI for reentrant execution (why use options = 8?)
    9... Because of #8, the latest VI reference is invalid.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • How do I transfer a color from one object to another without losing the gradient?

    COLORING AN OBJECT AND SAVING THE GRADIENT
    These are my notes.
    x
    Choose the EYEDROPPER tool.
    x
    Sample the color you want from an object in your image.
    x
    Double-click on the fill icon at the bottom of the tool panel.
    This brings up the COLOR PICKER panel.
    In that panel, you'll find the numeric value of the color you sampled.
    I followed these instructions but when the COLOR PICKER panel came up, it didn't show the color it was suppose to show.  The color I sampled with the eyedropper was a light blue with a gradient.  I had a few different files up with the same image.  One file brought up the color orange in the Color Picker panel.  And another file brought up a total BLACK, with a numeric value of 0000!  Can anyone tell me what's happening? 

    My guess is the eyedropper tool is struggling.  The best way and the one I use is to get color readings in Photoshop using its eyedropper tool.  Write down the color percentages for each color you want from the image.  Then, in Illustrator, I use the color palette to create new swatches using the percentage I wrote down from the actual image file.  Those new swatches can be used ( or transferred to ) in the gradient palette.  I have never used the eyedropper tool for getting color from anywhere in Illustrator.  But, that's just me.

  • How do you move apple configurator from one mac to another mac?

    I want to move the configuraton of apple configurator to a new computer. How?

    Thanks for the reply.
    burgback wrote:
    [...] Are you able to wipe a device manually and then plug it in to the laptop to re-configure without giving you to much of a hassle?
    I guess you mean whether I would be able to add one of the iPads to the new AC Mac by putting it in Restore mode and supervising it from that Mac? That will probably work. My problem is, that I've done that with the whole batch (60+ as I said earlier) when moving to a dedicated account within my own PowerBook some time ago. That takes an awfull lot of time, because it involves doing manual tweaking per iPad and adding the purchased apps again (in the Netherlands we don't have VPP so that is a manual process).
    I would really rather have the settings transfered and continue working on the Mac Mini than starting all over again.
    Regards, Eerk

  • How do you move the iphone from one computer to another.

    I am having a lot of trouble with a computer so I started using a different one. I have never had an iphone on this computer. When I hook up the phone and try to put anything on it, like a ringtone, it says that the phone is using another iTunes and it wants to erase all the content of the phone. I searched the internet and it says to just move it and all will be good. This I have found is not true!!

    You need to transfer your iTunes library from your old computer to the new or different computer per the instructions included with this link. Transferring your iTunes library from your old computer to the new or different computer you will be be using now to sync your iPhone with per the instructions included with this link (along with authorizing the new or different computer with your iTunes account with iTunes) will prevent any iTunes content on your iPhone that was transferred from your old computer from being erased from your iPhone with the first sync with iTunes on the new or different computer.
    http://support.apple.com/kb/HT1751

  • How do you transfer iTunes music from one account to another on the same computer??

    i am having issues trying to copy some of my music from my itunes library to my wife's. we each have seperate accounts on the same computer(mac mini, os X). i am new to using the mac's, and have no idea of how to go about this. i have seen some stuff on using public folders, but i could not find mine, also used the sharing option under preferances, and that didnt work for me as well.... but like i said, i am new. if anyone could please help that would be greatly appreciated. thanks

    Here's a support article that might help you:
    http://support.apple.com/kb/HT1203

  • How do you pass a variable from one form to another

    Sorry, I am new at this.
    I have an ID on one form and I want to pass it to another form and then populate a text field on the second form. How is this accomplished.

    There are various ways to accomplish this depending on your applications' needs.
    Read up on the manual, especially on session state management http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10499/concept.htm#CIHCFHBD
    This will get you familiar with the basics of url syntax and and session state after which you will have no problem implementing what your asking

  • How do you pass a variable from one page to another thru a button

    I have a page that has a button that goes to another page and allows the user to create a new record related to the data on the previous page.
    The first page is a master, while the second page is a detail. I need the primary key from the first page to update a column in the detail page.
    How do I get the primary key in the second page and how do in put the data in the correct column?

    Hi Nielsen,
    The master detail form should handle everything for you already...Select all rows in each table but only display the records besides the primary keys. Try creating a new master-detail form with this idea, don't bother trying to change some other page.
    Mike

  • I'm relatively new with my iPad...how do you upload your information from one iPad to another on the computer?

    I've been using a borrowed iPad from work.  Now I have my own and I need to upload the apps and photos from the borrowed iPad to my iPad!  I've connected the iPad to my PC but haven't been able to bring up my apps and photos to upload to my computer. 

    You need to sync the iPad using iTunes but you can only do this with one computer.
    Cancel auto-sync
    On a Mac, go to the iTunes menu -> Preferences -> Devices.
    On a PC, go to Edit -> Settings -> Devices
    You would need to transfer purchases
    http://support.apple.com/kb/HT1848
    Import photos taken with the device, or imported
    http://support.apple.com/kb/HT4083
    Find a 3rd party program to transfer synced photos (they will not be at full resolution)
    Examples
    http://www.copytrans.net
    http://www.mp4converter.net/ipad-to-mac-transfer.html

  • How do you transfer premiere elements11 from one pc to another pc?

    i have been having trouble with this. i have the serial number too. i need it on my new pc and off of my old one. its hard because they already made 12 so i cant get the trial to activation for 11. i didnt buy it with disc version. i have the online version that i bought on amazon

    The Elements Tutorial Links Page http://forums.adobe.com/thread/1275830 may also help
    -has links to the FAQ/TIPS pages AND download versions 7-thru-12
    This time, write your download file (and a text file with your serial number) to a DVD as a backup
    You also need to make a full copy of your boot/software drive to a USB hard drive
    The product I use is at http://www.terabyteunlimited.com/image-for-linux.htm
    Image runs off of a bootable CD via Linux (the Zip you download includes a program to make the bootable CD) and it reads EVERYTHING on the drive, even the hidden registration information, so everything is restored when needed... and you may restore the image to a brand new drive in case of a crash, and not have to re-install anything

  • How do I move a face from one photo to another  in pse 12?

    How do you move a face from one photo to another in PSE 12?

    In Editor, go to the expert tab.
    Open picture B, the one you wish to select something from (face) to add to another picture.
    Use one of the selection tools, e.g. selection brush, lasso tool, to select the object. You will see an outline ("marching ants") once the selection is complete
    Go to Edit menu>copy to copy the selection to the clipboard
    Open picture A, then go to Edit>paste
    Use the move tool to position object from picture B.
    In the layers palette you should see picture A as the background layer, and object B on a separate layer.

  • How do I share several contacts from one iCloud account to another?

    How do I share several contacts from one iCloud account to another iCloud account?

    Hi charlesfromlymington,
    Welcome to the Apple Support Communities!
    I understand that you would like to share a contact. Please use the information in the iOS 8 iPhone User Guide (page 139) for information on this process. When the recipient receives the contact, if iCloud Contacts are enabled, it will be added to their Contacts.
    manuals.info.apple.com/MANUALS/1000/MA1565/en_US/iphone_user_guide.pdf
    Share a contact. Tap a contact, then tap Share Contact. See Share from apps on page 35.
    Cheers,
    Joe

Maybe you are looking for

  • New Customer with Service Issue

    I am very frustrated with Verizon & customer service. Our family is new to Verizon within the last month. We drop calls all the time and get choppy service by our house. I talked to local store and they advised for me to call Customer Service. The re

  • Aperture - Transfer a photography folder and sub-folders to the library

    Hi All, Being a photographer, I recently jumped from my Dell XPS to the latest MacBook Pro and am still new on the use of Aperture. Working on PC before then, I used to work a lot on Adobe Bridge to organise my pictures. I now work with Aperture that

  • Creating an expandable text field without a scrollbar

    Hi All! Hope someone can help. I need to create a flowable subform that will allow text fields to expand without a scrollbar. I have been researching the forums and have found this thread: http://forums.adobe.com/message/2372965 When modifying the te

  • Problem in displaying stack canvas.....

    anyone plz help...... First let me explain wat I hav done I have a form module with two canvas - one is of content type(Canv1) and another is stacked type(stack1).. In Canv1 there is a button (Click) in WHEN-NEW-FORM-INSTANCE trigger hide_view('stack

  • Globally removing an illegal symbol from file names in the finder

    I recently discovered that my method of dating files makes use of the illegal symbol, '/'. Now I have thousands of files with that symbol in them and am having trouble transferring them to my new hard drive. Is there a was that I can globally remove