This works in AS2, please help me get it to work in AS3

I have code for a collapsing menu in actionscript 2:
counter=menu_num;
if (counter == 1) {
     while (Number(counter)<6) {
          counter = Number(counter)+1;
          setProperty("tocAni.tocMov.menu"+counter, _y, getProperty("tocAni.tocMov.menu"+counter, _y)-65);
} else if (counter == 2) {
     while (Number(counter)<6) {
          counter = Number(counter)+1;
          setProperty("tocAni.tocMov.menu"+counter, _y, getProperty("tocAni.tocMov.menu"+counter, _y)-140);
} else if (counter == 3) {
     while (Number(counter)<6) {
          counter = Number(counter)+1;
          setProperty("tocAni.tocMov.menu"+counter, _y, getProperty("tocAni.tocMov.menu"+counter, _y)-125);
} else if (counter == 4) {
     while (Number(counter)<6) {
          counter = Number(counter)+1;
          setProperty("tocAni.tocMov.menu"+counter, _y, getProperty("tocAni.tocMov.menu"+counter, _y)-85);
} else if (counter == 5) {
     while (Number(counter)<6) {
          counter = Number(counter)+1;
          setProperty("tocAni.tocMov.menu"+counter, _y, getProperty("tocAni.tocMov.menu"+counter, _y)-85);
I have this code on frame 2 in my main timeline and the same code on frame 3 that gives positive values to the variable amounts, (Frame 2 is up Frame 3 is down)... I have 6 menu movies named sequentially that contain a main link and various amounts of sublinks, (the reason there are different variable values assigned). When you click any of the main links it calls to one of the frames on the main time line, sets the variable menu_num to the menu being clicked, (i.e.. clicking menu movie one main link sets menu_num variable to 1) and moves all the menu movies below the clicked main link up or down the value indicated in the line matching the correct counter value.
I have attempted to rewrite this code this way:
var counter:Number=menu_num;
if (counter==1) {
    while (Number(counter)<6) {
        counter=Number(counter)+1;
        tocAni.tocMov.menu+counter.y,tocAni.tocMov.menu+counter.y-65;
} else if (counter == 2) {
    while (Number(counter)<6) {
        counter=Number(counter)+1;
        tocAni.tocMov.menu+counter.y,tocAni.tocMov.menu+counter.y-140;
} else if (counter == 3) {
    while (Number(counter)<6) {
        counter=Number(counter)+1;
        tocAni.tocMov.menu+counter.y,tocAni.tocMov.menu+counter.y-125;
} else if (counter == 4) {
    while (Number(counter)<6) {
        counter=Number(counter)+1;
        tocAni.tocMov.menu+counter.y,tocAni.tocMov.menu+counter.y-85;
} else if (counter == 5) {
    while (Number(counter)<6) {
        counter=Number(counter)+1;
        tocAni.tocMov.menu+counter.y,tocAni.tocMov.menu+counter.y-85;
I receive this error code when publishing in strict mode: (I receive multiples of the error, but I will only include the first)
Location - course, Layer 'tocAction', Frame 4, Line 5
Description - 1119: Access of possibly undefined property y through a reference with static type Number.
Source - tocAni.tocMov.menu+counter.y,tocAni.tocMov.menu+counter.y-65;
This is the script being used on the main link for down: (the main link is called downBT, on frame label down I have the up button)
//Listener
downBT.addEventListener(MouseEvent.CLICK, clickDownBT);
//Function
function clickDownBT(evt:MouseEvent):void {
    root.menu_num="1";
    var callDown:Function = Object["root.down"] as Function;
    gotoAndStop("down");
Any help is greatly appreciated.
A working example of this in AS2 can be found here... http://webresent.com/projectSamples/training/CBTsample/index.htm

assuming all your variables are defined:
counter=menu_num;
if (counter == 1) {
     while (Number(counter)<6) { // you shouldn't need to cast counter or, if you do, do it in the first line only
          counter = Number(counter)+1;  // this can be shortened to counter++;
tocAni.tocMov.["menu"+counter].y-=65;
} else if (counter == 2) {
     while (Number(counter)<6) {
          counter = Number(counter)+1;
tocAni.tocMov.["menu"+counter].y-=140;
} else if (counter == 3) {
     while (Number(counter)<6) {
          counter = Number(counter)+1;
tocAni.tocMov.["menu"+counter].y-=125;
} else if (counter == 4) {
     while (Number(counter)<6) {
          counter = Number(counter)+1;
     tocAni.tocMov.["menu"+counter].y-=85;
} else if (counter == 5) {
     while (Number(counter)<6) {
          counter = Number(counter)+1;
          tocAni.tocMov.["menu"+counter].y-=85;

Similar Messages

  • Ios7 update audio is hissing and static. Please help me get rid of this noise so I may enjoy my audio on my iPad

    Ever since the ios7 update my audio is hissing and has static. Please help me get rid of this noise so I may enjoy my audio on my iPad

    Just for the record, this is what I wrote to Apple feedback:
    (If anyone really knows what the problem is, please let us know.)
    Apple iPad mini. Re: Hiss
    Hi. I am one of the very unhappy people who can't use the iPad for recording since getting ios7.  The apple forum is replete with stories like mine: ios6 recording was quiet - ios7 is noisy. I have tried every suggestion. Why won't anybody at apple tell us what the problem is? I have been using macs since 1986. All I want to do is record my songs on my iPad. Unfortunately for me, I recently brought my iPad-mini refurbished so there is no warranty. If I had bought it new I would be at the Genius Bar until I got the problem fixed. Did I mention how unhappy I am?  Here are the specs: 1st gen iPad mini running ios7. Recording onto Multitrack DAW with a Samson Go mic to a 30-pin USB camera adapter, into an apple brand lightening adapter into iPad mini. Everything works fine except for the HISS.
    Jeff

  • Error 213.5 Please help me get DW working again. Thanks CaptJim4685

    I have a Mac OS 10.10 used the Migration Assistant to move all files from old computer to new computer yesterday. Now can not use my Dreamweaver CS 5.5 program I have my original install disk. Tried that. get error 213.5 Please help me get DW working again. Thanks CaptJim4685

    Hi Nancy O.
    Thing is, I was using it on my old MacBookPro, also w/ yosemite. No problem. So I think it should run on the new one with the same OS.
    I did figure out how to find the CC cleaner log file. It had a lot of stuff in it, but did not indicate any kind of failures. I did not see the word “failure in the log file at all.
    After your suggestions, I went thru all the steps again - twice - very carefully emptying the trash between steps and restarting. Got the same error message at the end.
    Now, I still have 5.5 working on the old computer. That was my first and only install. My notes suggest  I installed it in 2011.
    If I knew for sure that if I deactivated it (if I knew how to do that) on the old computer, and uninstalled it, AND I could then count on the install working on my new computer, I would do it, but I am afraid to do that for fear that then I wouldn’t have it to use at all.
    I had expected it to transfer over, and then I would clean the old computer, as my son wants it for his wife, They have no use for DW.
    I also had trouble w/ MS Office, but they allowed me to call them and get a new install code. Now that Works fine.
    I wish Adobe were as accommodating. I have my original install disk & code. I never expected any of this trouble.
    I hope you can come up with a new plan. I really can’t afford to buy a new copy, especially when I know that this one should work, if it would just get rid of this blocking action.
    I only use it for editing my own personal family website: http:www.americanfenner.com.  I am not a webmaster/webwriter/ computer programmer or anything like that. Just an old guy doing personal stuff on my mac.
    Jim Fenner
    [email protected]

  • All of the sudden I am getting two windows when clicking on a link in Facebook. How can I stop this from happening? Please HELP

    Today I discovered that when I was in facebook, and clicked on a link, anywhere, I would get a blank window and then another window would open up and have the links information on it. Things are really slow with this happening. I've checked out the popup tab, and I don't have it checked. There is nothing in the list either. PLEASE help me get rid of this problem. I have uninstalled firefox and reinstalled it. Would downloading an older version help?? Thank you for any help you can give me.

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Can somebody please tell me how to fix this. when i try to install appleworks this pops up  so please help me i need to get this on my mac

    can somebody please tell me how to fix this. when i try to install appleworks this pops up
    so please help me i need to get this on my mac

    AppleWorks is a very old application and requires Rosetta to run under recent systems.
    Lion does not include Rosetta.
    If you browse this forum you will find many posts on this issue.

  • When attempting to start iTunes, I get the following: "The iTunes library file cannot be saved. An unknown error occurred (-50)." Can someone please help me get this fixed?

    When attempting to start iTunes, I get the following: "The iTunes library file cannot be saved. An unknown error occurred (-50)." Can someone please help me get this fixed?

    Same problem here since latest update.  As usual poor support from Apple with no answer or fix for this bug.

  • When I open Firefox browser, I get arcade music followed by siren. Please help me get rid of this.

    This morning at 10:30 AM PDT when I opened Firefox browser, I got an arcade type of sound followed by a siren sound which will not go away until I shut down Firefox. Please help me get rid of this annoying sound!
    == This happened ==
    Every time Firefox opened
    == today 5/21/2010

    This morning at 10:30 AM PDT when I opened Firefox browser, I got an arcade type of sound followed by a siren sound which will not go away until I shut down Firefox. Please help me get rid of this annoying sound!

  • My screen won't work, i have tried turning it off but i cant swipe the power down button because my screen doesnt work. I have only had my iphone 4s for one day and this has happened, someone please help me.

    My screen won't work, i have tried turning it off but i cant swipe the power down button because my screen doesnt work. I have only had my iphone 4s for one day and this has happened, someone please help me.

    Did the trick!  Not sure what I did to cause the screen to go numb, but this worked perfectly!!!  I cleaned the screen and must have inadvertently selected something that locked the screen.  This perfect solution kept me from having to run to the Apple Store.  Many thanks.

  • Please help - i get as far as downloading illustrator cs6 then it asks me to close down adobe professional 8 which i dont have open then i have to close the whole thing down and start again - this keeps happening

    please help - i get as far as downloading illustrator cs6 then it asks me to close down adobe professional 8 which i dont have open then i have to close it down and start again

    You have Distiller (used by the PDF Printer) or the Acrobat Quick Launcher running in the background. Shut down the processes or terminate them in task manager.
    Mylenium

  • I have frequent instances of my Macbook Pro beeping 3 times and then I have to forcefully shut it down by pressing the power button. What is this all about? Please help. Thank you.

    I have frequent instances of my Macbook Pro beeping 3 times and then I have to forcefully shut it down by pressing the power button. What is this all about? Please help. Thank you.
    I saw this report being sent to Apple:
    Interval Since Last Panic Report:  581719 sec
    Panics Since Last Report:          10
    Anonymous UUID: F4CF708D-D85C-4EC5-8047-4FC22C6B03AF
    Fri Mar  7 13:00:14 2014
    panic(cpu 0 caller 0xffffff80002d1208): Kernel trap at 0xffffff800020c590, type 14=page fault, registers:
    CR0: 0x0000000080010033, CR2: 0x0000000000000000, CR3: 0x0000000007541000, CR4: 0x0000000000040660
    RAX: 0xffffff8000000000, RBX: 0xffffff800d35a870, RCX: 0xffffff800cf55cd8, RDX: 0xffffff80008a8fcc
    RSP: 0xffffff805e5f3d60, RBP: 0xffffff805e5f3da0, RSI: 0x000000001dcd6500, RDI: 0xffffff800d168778
    R8: 0x0000000000000001, R9: 0xffffff805e5f3e88, R10: 0x0000000000000011, R11: 0x0000000000000000
    R12: 0x0000000000000000, R13: 0xffffff800d168770, R14: 0xffffff800d168778, R15: 0x0000000000000000
    RFL: 0x0000000000010082, RIP: 0xffffff800020c590, CS:  0x0000000000000008, SS:  0x0000000000000010
    Error code: 0x0000000000000000
    Backtrace (CPU 0), Frame : Return Address
    0xffffff805e5f3a00 : 0xffffff8000204d15
    0xffffff805e5f3b00 : 0xffffff80002d1208
    0xffffff805e5f3c50 :
    Model: MacBookPro8,1, BootROM MBP81.0047.B27, 2 processors, Intel Core i5, 2.3 GHz, 4 GB, SMC 1.68f99
    Graphics: Intel HD Graphics 3000, Intel HD Graphics 3000, Built-In, 384 MB
    Memory Module: global_name
    AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xD6), Broadcom BCM43xx 1.0 5.100.198.104.5)
    Bluetooth: Version 2.4.5f3, 2 service, 12 devices, 1 incoming serial ports
    Serial ATA Device: Hitachi HTS545032B9A302, 298.09 GB
    Serial ATA Device: OPTIARC DVD RW AD-5970H
    USB Device: FaceTime HD Camera (Built-in), 0x05ac  (Apple Inc.), 0x8509, 0xfa200000 / 3
    USB Device: Hub, 0x0424 (SMSC), 0x2513, 0xfa100000 / 2
    USB Device: BRCM2070 Hub, 0x0a5c  (Broadcom Corp.), 0x4500, 0xfa110000 / 5
    USB Device: Bluetooth USB Host Controller, 0x05ac  (Apple Inc.), 0x821a, 0xfa113000 / 8
    USB Device: Apple Internal Keyboard / Trackpad, 0x05ac  (Apple Inc.), 0x0245, 0xfa120000 / 4
    USB Device: Hub, 0x0424 (SMSC), 0x2513, 0xfd100000 / 2
    USB Device: IR Receiver, 0x05ac  (Apple Inc.), 0x8242, 0xfd110000 / 3

    Hmm. The problem still may be the RAM - Apple buys the RAM it puts in its machines from third-party vendors (usually Hynix) so it could be a RAM problem.
    There are a couple of things that you can do yourself before taking your machine into an Apple Store or an AASP... download and run an application named Rember that will run a RAM test for you - let it run for a couple of hours or even overnight. If it turns out that your RAM is faulty, Rember will let you know. If it is faulty, then you have a couple of options - replace the RAM yourself or (particularly if you're under warranty still) take the machine to an Apple Store or AASP and have them replace the RAM.
    If Rember finds no fault with the RAM, then you'll need to take it into an Apple Store/AASP and get a free diagnosis on the machine. Three beeps do usually indicate faulty RAM, but if it tests good with Rember you likely have another problem - it could be something as simple as the RAM, somehow, not seated correctly or signs of another hardware problem.
    Run Rember first... call back with results.
    Good luck,
    Clinton

  • Please help to get onhand stock report with last purchase and billed date warehouse and item wise

    please help to get onhand stock report with last purchase and billed date warehouse and item wise

    Hi Rajeesh Ambadi...
    Try This
    SELECT distinct T0.ITEMCODE , t1.ItemName, T0.ONHAND as 'Total Qty',  
      T1.LASTPURDAT ,t1.LastPurPrc
    FROM OITW T0 INNER JOIN OITM T1 ON T0.ITEMCODE = T1.ITEMCODE
    INNER JOIN OITB T2 ON T1.ITMSGRPCOD=T2.ITMSGRPCOD left join ibt1 t3 on t3.itemcode = t0.itemcode and t3.whscode = t0.whscode
    WHERE
    T0.ONHAND>0
    AND T0.WhsCode ='[%0]'
    Hope Helpful
    Regards
    Kennedy

  • Switching from a PC to a MAC please help me get online!

    okay so i just got my macbook and i am used to getting online from my PC. i used to just connect to my wireless network in my house, and then open up "broadband" connection, type in my username and password and i was connected, i cant quite find out how to do this on my mac please help me
    also what is PPPoE?

    Make sure airport is turned on. There should be an icon in your menu bar that looks like an antenna or fan. Most of the bars should be black. Click on that and select "broadband" from the menu.

  • After updating my computer, my iweb is not opening...please help me get it back!

    after updating My computer, my iweb is not opening...please help me get it back!

    Verify that your domain file is located in your Home/Library/Application Support/iWeb folder which will be invisible. However, 
    NOTE: In Lion and Mountain Lion the Home/Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and press the Return key - 10.7: Un-hide the User Library folder.
    For  Mavericks, 10.9,  go to your Home folder and use the View ➙ Show View Options menu to bring the this window:
    Next:
    To open your domain file in Lion, Mountain Lion or Mavericks or to switch between multiple domain files Cyclosaurus has provided us with the following script that you can make into an Applescript application with Script Editor. Open Script Editor, copy and paste the script below into Script Editor's window and save as an application.
    do shell script "/usr/bin/defaults write com.apple.iWeb iWebDefaultsDocumentPath -boolean no"delay 1
    tell application "iWeb" to activate
    You can download an already compiled version with this link: iWeb Switch Domain.
    Just launch the application, find and select the domain file in your Home/Library/Application Support/iWeb folder that you want to open and it will open with iWeb. It modifies the iWeb preference file each time it's launched so one can switch between domain files.
    WARNING: iWeb Switch Domain will overwrite an existing Domain.sites2 file if you select to create a new domain in the same folder.  So rename your domain files once they've been created to something other than the default name.
    Since iWeb has discontinued by Apple the new systems don't handle the iWeb preference pane as it was in earlier.  The script corrects that situation and once you open the domain file the first time you can just use iWeb to open it from there on.  However, you'll need it if you plan on using more than one domain file. And adhear to the warning above.

  • Can someone please help me get some?

    I was a summer intern student worker and the company brought us Macbooks. I never really knew about Macbooks at the time and kinds still dont and now my macbook is starting to act up I see I lost my repair plan cause its been a min or whatever. So can someone please help me get sometype of  repair something?

    Please make a Genius Appointment and take it in for service.

  • PLEASE HELP ME GET THE SOFTWARE TO INSTALL ON MY COMPUTER SO I CAN HAVE WIRELESS INTERNET

    Okay i know this is off the tangent but i am losing my mind i have a wireless B broadband router model number befw11s4 and i lost the cd upon a long tideous move so can you please anyone PLEASE HELP ME GET THE SOFTWARE TO INSTALL ON MY COMPUTER SO I CAN HAVE WIRELESS INTERNET i am losing my mind i callled linksys and they were no help telling me i had two option to either buy a 29.99 plan or a 39.99 plan and i couldnt get  the help i needed unless i bought the **bleep** plans so i said kindly thank you for your time ...I figured i would post a thread up asking if someone anyone can please help me get this software or cd so i can install it on my computer !! THANK YOU FOR YOUR TIME !!!!!
    Message Edited by kent07 on 11-20-2009 05:46 PM

    You don't need any software to run the router at all.  Connect with your wired computer to 192.168.1.1 username blank, password admin and configure your router manually like everyone else. 

Maybe you are looking for