Changing the already given actionscript

I have two action scripts in which i have to change the following, but im still unsure what parts I need to edit and what i should write instead
1. position the first main circle in the centre of the stage;
2. set all drawing colours for circles to random shades of green;
3. set all drawing colours for branches to black;
4. give each circle 3 branches instead of 2;
5. replace all circles with squares using what would have been the circle's radius as the square's width;
6. stop the automatic animating rotation and only have the objects rotate when the space bar is held down.
package
import flash.display.Sprite;
public class Branch extends Sprite
   var theTree:Tree;
   var level:Number;
   var children:Array;
   public function Branch (controller:Tree, l:Number)
      theTree = controller;
      level = l;
      var myColour:Number = Math.floor(Math.random()*0xFFFFFF);
      var rad:Number = (theTree.maxlevel - level) * 10;
      var linelen:Number = (theTree.maxlevel - level) * 30;
      var lineweight:Number = (theTree.maxlevel - level);
      this.graphics.beginFill(myColour);
      this.graphics.drawSquare(0, 0, rad);
      this.graphics.endFill();
      this.graphics.beginFill(myColour);
      this.graphics.drawSquare(0, -linelen, rad);
      this.graphics.endFill();
      this.graphics.moveTo(0,0);
      this.graphics.lineStyle(lineweight, myColour);
      this.graphics.lineTo(0, -linelen);
      if (level < theTree.maxlevel)
         children = new Array();
for (var x:Number = 0; x < theTree.children; x++)
            var childBranch:Branch = new Branch(theTree, level+1);
            childBranch.x = 0;
            childBranch.y = -linelen;
            addChild(childBranch);
            children.push(childBranch);
      this.rotation = Math.floor(Math.random() * 360) - 180;
public function update()
   if (children)
      for each (var child in children) { child.update(); }
   this.rotation += 1;
function keyPressed(event:KeyboardEvent):void
if(event.keyCode == Keyboard.SPACE)
package
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class Tree extends MovieClip
   var children:Number = 2;
   var maxlevel:Number = 5;
   var trunk:Branch;
var timer:Timer;
   public function Tree ()
      trunk = new Branch(this, 1);
      trunk.x = 200;
      trunk.y = 200;
      addChild(trunk);
timer = new Timer(10);
         timer.addEventListener(TimerEvent.TIMER, controlLoop);
         timer.start();
function controlLoop(event:TimerEvent):void
        trunk.update();

(that sounds like your homework.)

Similar Messages

  • MCRM_SETTINGS  report cant change the already existing consumer

    Hi Middleware gurus,
    I have a problem in setting up of  CRM middleware setup with ECC .  The scenario is ECC is connected to CRM already and data is transferred, so as a result of that for all the objects in CRM the default consumer is CRM.  And now due to some requirements , i want to connect this same CRM system to another ECC and so the requirement is to change this already existing default consumer to a new consumer as per the new ECC system.
    SO, I ran the report MCRM_SETTINGS to change the consumer but the result says- the object is already a consumer.
    So, now the question is - cant i over write the already existing consume  to a new consumer...
    Regards,
    Neni.

    Hello Neni,
    In case you want to connect 1 CRM to 2 ECC systems, you'd be following a MEP(Multiple Exchange Projects) scenario and not a MCRM setting so MCRM_SETTINGS won't be useful here.
    Or do you want to disconnect the first ECC and connect a new ECC to the same CRM?
    can you please clarify?
    BR,
    Rohit

  • Change the already installed Win 8.1 BIOS mode from Legacy to UEFI

    Hey,
    It seems that my Windows 8.1 is installed in BIOS mode: Legacy as "msinfo32.exe" shows. I can boot into it with no issue, but when I go to my laptop's BIOS settings and change the mode back to UEFI, it gives me an error "Operating system not
    found" (not sure about the exact error message).
    I am just wondering if it is possible to change the Windows 8.1 BIOS mode to UEFI so when I change the laptop's BIOS settings back to UEFI, it can boot into it?
    Regards.

    Hi Amin CiscoSoft,
    Since UEFI mode need an EFI system partition (ESP) which has the partition type ef00, usually contains a FAT32 file system. We need to recreate the partitions needed for booting the installation media in UEFI mode.
    Before you doing that we VERY recommended for you to read all contents including Prerequisites and warring paragraph in links below, then perform a backup of your data. If you have a second disk drive big enough, you can simply create a system image and
    able to recover the full installation as it was before you started this procedure if anything goes wrong.
    Since the steps are complicated, please follow the steps in
    http://social.technet.microsoft.com/wiki/contents/articles/14286.converting-windows-bios-installation-to-uefi.aspx
    Regards

  • How to change the already synced voice memo status to not yet sync

    Hi
    When syncing my iPhone with my computer, some random error occurred and thus the syncing process was not completed and it was forced to stop. Due to this reason, i have 5 voice memos were not transferred into my computer but all of the voice memos were marked with today's date under the 'Date Added" column. In fact, they were all not transferred into my computer. Any advice or solution for this kind of problem?
    Thanks in advance
    Regards
    Cashtom

    edit: If Spotlight still cannot find it, then... (forgot not everyone uses Spotlight)
    Backup, Restore (to factory default), Restore data from Backup.
    iPhone and iPod touch: About backups
    iTunes: Backing up, updating, and restoring your iPhone, iPad, or iPod touch software

  • Best way to draw an asset if I want to change the colour of it?

    If I draw something manually, can I still change the colour by actionscript?
    I want to draw a cat, and the cat colour depends on the the user choice in the previous 'screen'.  How should I go about this?
    Thanks.

    Yes, there are a couple ways. You can use the ColorTransform class. Or you can use one of the Tweening engines - it's really easy to tint objects using TweenLite. You can even test in the demo at http://blog.greensock.com/tweenlite/
    Scroll down a bit to the demo... pick a color in the tint box and hit Tween.

  • How can I change the "name" on my iphone, in the find my phone app

    How can I change the "name" given to my phone (i.e. Sally Jone's phone) on the Find my Iphone app?

    I'm not sure but try via itunes
    Right click on the name of your phone when it appears in the left column

  • I have purchased a new iPad and given my old one to my husband.  How do I change the Apple ID over to him.  We are having continuous confusion between the two iPads

    I have purchased a new iPad and given my old one to my husband.  How do I change the Apple ID over to him.  We are having continuous confusion between the two iPads

    Hi Marg42,
    Thanks for visiting Apple Support Communities.
    First, your husband can create his own Apple ID via the web, computer, or iPad, if he hasn't already:
    My Apple ID
    https://appleid.apple.com
    iTunes: How to set up an Apple ID within iTunes
    http://support.apple.com/kb/ht2731
    Next, he can sign out of the Apple services that are currently using your Apple ID on your old iPad, and sign in with his own.
    This article has instructions for doing so for specific Apple services:
    Apple ID: What to do after you change your Apple ID
    http://support.apple.com/kb/HT5796
    Alternately, he can erase the device and set it up as new using the steps in this article:
    iOS: How to back up your data and set up your device as a new device
    http://support.apple.com/kb/ht4137
    Best Regards,
    Jeremy

  • How to fix my Apple ID from not being disabled? I have changed the password many times already and it still wont let me update apps or download apps

    How to fix my Apple ID from not being disabled? I have changed the password many times already and it still wont let me update apps or download apps

    Apple ID disabled
    http://support.apple.com/kb/TS2446
    If you still have problem, contact iTune Support
    https://ssl.apple.com/emea/support/itunes/contact.html

  • I just installed iTunes on my computer, where I already have all my music. I went to Edit Preferences Advanced, and changed the iTunes Media Folder Location to where I have all my music, in the "Local Disk." But iTunes wont import all my music. Help?

    I just installed iTunes on my computer, where I already have all my music. I went to Edit > Preferences > Advanced, and changed the iTunes Media Folder Location to where I have all my music, in the "Local Disk." But iTunes wont import all my music. Help?

    Have you looked in the Music App on your iPhone? On the iPhone music is played by the Music App not iTunes.

  • Regarding passport registration issues, I need to have a letter from you including both the old and new imei numbers. Could you please send me an email mentioning that I have changed the phones with the given imei numbers?

    Regarding passport registration issues, I need to have a letter from you including both the old and new imei numbers. Could you please send me an email mentioning that I have changed the phones with the given imei numbers?

    You're not addressing Apple here. This is a user-to-user technical support forum. If you want to contact Apple, use the Contact Us link at the bottom right of every page for information on how to do so.
    Best of luck.

  • How can I change the password in the iBook donated to our nonprofit.  No password was given with the iBook?  We need to put in printer and other software.  Help, we can use the laptop without changing the password.

      How can we change the password in the iBook donated to our nonprofit?  No password was given with the iBook and every time we try to install items, the password window pops up.  We need to put in printer and other software.  Help! We can use the laptop without changing the password.

    If you did not get an OS X install-restore DVD with the computer you may need
    to buy one from somewhere, and you may be lucky to get a retail OS X 10.5.x
    version. The original grey-label install set of software and OS X it shipped with
    likely would be an older system than Leopard 10.5. Last versions of G4 Mac, &
    G5, shipped with a Tiger 10.4 system; so did early Intel-based Mac. Grey discs
    which accompanied other computer build models generally do not interchange.
    The last OS X version a PowerPC architecture can use, if supported, is 10.5.8.
    A PPC processor at 867MHz & faster should be able to run OS X 10.5 Leopard.
    {With the correct disc installer, you can use it to change a password and other
    things including re-install, and perform disk utility functions, etc.}
    There is a chance you may be able to get a white-label Replacement 10.4 DVD
    or Replacement 10.5 DVD from AppleCare or the online Apple Store (800myapple)
    from a Mac OS X system specialist; these have been available yet hard to get
    as not all persons involved with them seem to know if they still exist until someone
    is asking. These aren't retail stock, are special discs for computers who could use
    a system later than original old discs; these are complete install discs not for one
    specific series of Mac. Generally they'd work in supported PowerPC G4/G5; but
    do not replace specialized original install DVD, such as an early Intel mac requires.
    You'd need to have a serial number of the computer, and a method of payment
    when seeking some replacement system media from Applecare or Apple sales
    and these discs are not available in a retail store. The original Retail discs are
    labeled differently and shipped in a retail box with a big X on the front. Other
    sources for retail 10.4 Tiger or 10.5 Leopard may be online via amazon sellers
    or computer resellers who handle repaired Macs. Avoid mystery grey label ones
    that were intended to be sold and kept with their original computer kits.
    Good luck!

  • I cannot figure out how to change the photo size on my iPhone 5s.  I was given the choice of small, medium or large the first time I took a picture.  Now I have no idea how to change it to medium.  Can anyone help?

    I cannot figure out how to change the photo size on my iPhone 5s.  The first time I took a pic it asked if I wanted smalll,  medium or large and listed the pixels.  I chose small but am now finding that is too small.  Can anyone help me set it to medium now?  I can't find any setting for that.  I'm a newby to iPhones and have no idea what I'm doing.  Thanks for any help you can offer.

    By "sending" do you mean sending email?
    If so, what app are you using to take the photos on your iPhone 5? Or are the photos from a different source (saved to your Camera Roll from somewhere else, like a web page or Messages)?
    My guess is that Mail gives you the option to send different file sizes when it detects you are trying to Mail a really large photo file. The size of photos on the iPhone 5 is really big and some email providers may stop your mail from being delivered if attachments are too large. Thus, Mail tries to help you by offering to resize the photo.
    I suspect that if you are sending smaller files, Mail does not bother giving you options to save a smaller version. In fact, I have seen this behavior. So, if the photo is already "small enough", it gets sent as-is.
    To my  knowledge, there is no global iOS setting for this. Some apps may have different rules, of course.

  • I recently changed my Apple ID.   When I try to change my iCloud account on my Mac. I cannot access the account. I've changed the password once already. Any suggestions? My iPhone's account is fine.

    I recently changed my Apple ID.   When I try to make changes to my iCloud account on my Mac., I cannot access the account via System Preferences. I've changed the password once already.   My iPhone's iCloud account is fine. At this point my iCloud account no longer is working with my Mac. Does anybody have any suggestions?

    I finally figured out the answer to my own question. I created a new iCloud account on my Mac. Problem solved!

  • How do I change the apple ID associated with my dev account to a different, already existing apple ID/account

    Hi,
    I currently have an iPhone Dev account, which is associated with a certain apple account.  I also have a different apple account, that I have already created.  I wish to change the dev account to use this other account.  I know you can change your apple ID, but I dont know how to change to an already existing account. When I tried to just change the appleID and email to match that of my other account, I just get an error saying that the email is already in use.
    Any thoughts?
    Thanks,
    rsm10

    Support - iOS Developer Program - Account Management

  • How do I change the color of font in a fillable form in Adobe Reader? How can I check if the writer of the document has given permission to edit color and not just add text?

    How do I change the color of font in a fillable form in Adobe Reader? How can I check if the writer of the document has given permission to edit color and not just add text? Please help! I'm technologically challenged.

    Most forms (99% or more) are created for simple text input, where you cannot change anything.
    The creator of the form could allow Rich Text input (which allows you to change font, text size, color, etc.), but frankly I have never seen such a form, and I wouldn't know how they look.  But I'm sure they would show some kind of controls to alter the text appearance.

Maybe you are looking for

  • Problems mailing pages from Safari

    At one time I was able to mail web pages or links from Safari with Mountain Lion, but now it has stopped working. The first time I try to mail a page, I'll get a new mail window open (and probably not coincidentally, a second instance of the Mail ico

  • How to upgrade to ipod touch 2.2.1 not 3.0

    Hello. I live in Azerbaijan and i got Ipod Touch 2.2. I want to upgrade it to 2.2.1 (i can't upgrade to 3.0, cuase it's impossible to buy something from Itunes Store from Azerbaijan). Is it possible to make it?

  • CF9.0.1 and Flex4 Remoting Issue

    We are trying to migrate our flex apps from CF8.0.1 to CF9.0.1 and we are getting an error that seems to be caused when trying to create a VO which is typed to a CFC that is in a directory below the webroot. This was working in CF8.0.1. The UserVO.as

  • No animation export, no animation saving...

    Hi, my problem is according to: -Windows 7 -Flash Professional test version I have built up a simple animation with 6 objects just moving in straight direction. All of them are just a classic tween from picture 1 to picture 2. I can test the animatio

  • Help, Re; filter effects

    I have been using PSE 7 for the past two years, missed 8 &9, just upgraded to PSE10, not sure if any changes were made too the filter gallery (effects).when I click onto a filter icon (neon glow) or any one of them for that matter, from the effects p