How to import variables from timeline to a class?

I'm pretty noobish to ActionScript 2.0, so I'm still reading an Ebook. But I wanna make a game where you can get skill points, and then use them on a buttons, and when you have pressed the button, your character gets 3+ speed. I can use the skill points and stuff, but I can't add the 3+ speed to my character, so I made a variable in frame 1 that's named "speedupgrade", and that variable gets 3+ if you press the button. And I made a variable in frame 3 called "speed1". And in my character, I made a variable "speed", and it was speed1+speedupgrade. I can show you guys the code.
On my button
on (release) {
          if (skill >= 1)
                    skill -= 1;
                    speedupgrade += 10;
          else
                    gotoAndStop(22);
frame 1
var skill:Number = 1;
var speedupgrade:Number = 1;
frame 3
var speed1:Number = 7;
My character
var speed:Number = speed1 + speedupgrade
I can't see the problem, because I'm not very experienced with this...

If you are expecting
var speed:Number = speed1 + speedupgrade
to automatically update every time the values of the variables change, that will not happen.  If the variables change you need to execute the code again so that the new values get used.
If you are just learning AS2, you should get away from a bad practice right away.  Do not place code "on" any objects, such as what you are doing with that button.  Give your button an instance  name and use it to assign code to it from the timeline so that you have all your code in one easy to find location.  If you named your button "btn", then the timeline code for it would be...
btn.onRelease = function(){
       if (skill >= 1) {
                 skill -= 1;
                 speedupgrade += 10;
        } else  {
                 gotoAndStop(22);
and if you have multiple button with the same code you could just create the function and assign it to the buttons ...
btn1.onRelease = btnClick;
btn2.onRelease = btnClick;
function btnClick(){
       if (skill >= 1) {
                 skill -= 1;
                 speedupgrade += 10;
        } else  {
                 gotoAndStop(22);

Similar Messages

  • How to import mailboxes from Time Machine to new Mac

    I had Time Machine backing up our old G5. We got a Mac Pro back in November and I never was able to import the mail from the G5 to the Mac Pro so I left it alone and just kept using mail on the old G5. Well, the G5 took a dump last monday. I currently have the Time Machine backup for that computer connected to our Mac Pro (but not using it as backup yet). So, the mail from the G5 should be on the Time Machine backup right? If so, can I import it into Mail on the Mac Pro?
    I also pulled one of the hard drives from the G5 and have it in the Mac Pro in the 2nd bay just to make sure that HD wasn't dead. It works fine and I tried importing the .mbox files from that drive but it appears that all the mail on that particular drive are from like 2006. So, again, I need to find out how to import mail from the Time Machine drive. Any thoughts?
    10.7.4
    Mail 5.2

    Back up what data? Mail data? I don't have any yet. I haven't used Apple Mail on this Mac Pro yet.
    Edit: Launching Mail and holding Option right afterwards does nothing. Holding down option and then launching Mail does nothing.
    Oooooh.... launching time machine while holding down option......
    Edit again.... I don't have a Time Machine menu because that disk is not currently set up as time machine for the Mac Pro yet. I don't want to use it as a backup for this computer yet. I just want to be able to pull some of the backed up contents from it until I'm set.

  • OBIEE 11g How to pass variable from one prompt to another prompt in dashboard page.

      How to pass variable from one prompt to another prompt in dashboard page.
    I have two prompt in dashboard page as below.
    Reporttype
    prompt: values(Accounting, Operational) Note: values stored as
    presentation variable and they are not coming from table.
    Date prompt values (Account_date, Operation_date)
    Note:values are coming from dim_date table.  
    Now the task is When user select First
    Prompt value  “Accounting” Then in the
    second prompt should display only Accounting_dates , if user select “operational”
    and it should display only operation_dates in second prompt.
    In order to solve this issue I made the
    first prompt “Reporttype” values(Accounting, Operational) as presentation
    values (custom specific values) and default presentation value is accounting.
    In second prompt Date are coming from
    dim_date table and I selected Sql results as shown below.
    SELECT case when '@{Reporttype}'='Accounting'
    then "Dates (Receipts)"."Acct Year"
    else "Dates (Receipts)"."Ops
    Year"  End  FROM "Receipts"
    Issue: Presentation variable value is not
    changing in sql when user select “operation” and second prompt always shows
    acct year in second prompt.
    For testing pupose I kept this presentation
    variable in text object of dashboard and values are changing there, but not in
    second prompt sql.
    Please suggest the solution.

    You will want to use the MoveClipLoader class (using its loadClip() and addListener() methods) rather than loadMovie so that you can wait for the file to load before you try to access anything in it.  You can create an empty movieclip to load the swf into, and in that way the loaded file can be targeted using the empty movieclip instance name.

  • How to import music from an external hard drive to my itunes on my computer?

    how can import music from an external hard drive that i saved my itunes music to. i dragged the music from my hard drive to the itunes on my computer but the music does not play from my itunes. it does however play on my ipod. it gives me an error that the original can not be found and do i wish to locate it. i am thinking that i did not drag the right file or all of the files necessary .thanks. kevin

    To import music into your iTunes library on the computer go to iTunes>Help>iTunes Help>Add items to iTunes and follow the instructions

  • How To import collections from Bridge cs6 To Bridge CC

    How To import collection from Bridge cs6 To Bridge CC??
    thx

    How To import collection from Bridge cs6 To Bridge CC??
    A collection is a bunch of aliases to the original files in their original place. If you have upgraded to CC on the same machine you can use the same collection, on a different machine it will possible not find the correct location again.
    On a Mac the path for the saved collections is : User / library/ application Support / Adobe/ BridgeCS6 / collections. Inhere are the saved collections showing the names you gave them. You can copy these collection files to the same location in Bridge CC.
    If you have a different machine you best first choose the collection and add a keyword with the name of the collection to all the files in this particular collection so you can use the find command to easily recreate the collection on your new machine.
    Maybe someone with more knowledge of Windows can show you the correct path but it should be something similar as on a Mac.

  • How to import videos from iPhone 4 to PC?

    I'm trying to get a video that I recorded and edited with my iPhone 4 and iMovie, on my PC so I can share it with others. It won't email because the file size is too big (but the video is only 1:20...) and I uploaded it to YouTube but they removed the audio because it's copyright infringment. I've going through My Computer and a few other things and all the photos get imported but when I try and play an imported video it won't load and just freezes. Any tips?

    http://lmgtfy.com/?q=how+to+import+videos+from+iphone

  • How to import project from Final cut pro 7 to X ?

    how to import project from Final Cut Pro 7 to X ?

    please tell me if FCP 7can create any kind of file that FCP X can read ?
    I can read FCP 7 .mov file with QuickTime, but not with FCP X ? what can I do ?
    Sould I use a Premiere on PC to make files compatibles in between 2 apple Softwares ?
    I have a lot a files that have been created with FCP 7 and I just buy FCP X , so I am Stuck !!!
    thank you in advance

  • HT4906 how to import photos from photo stream into an event?

    How to import photos from photo stream into an event?

    How to import photos from photo stream into an event?
    In iPhoto 9.4.3 the following works:
    If you have not auto imported the photos from the Photo Stream, as Larry suugests, select the photos that you want to import in the Photo Stream, and drag them to the "Events" view in the Source List. They will be imported as new events, auto split with respect to your preferences.
    Regards
    Léonie

  • How to import photos from a folder that contains hundreds of folders to Photos keeping the same folder structure?

    How to import photos from a folder that contains hundreds of folders to Photos keeping the same folder structure?

    You'll have to do that manually, i.e. export each album of photos to a folder with the same name located on your hard drive via  the File ➙ Export ➙ File Export menu option.
    OT

  • How to import videos from iphoto

    it did it the first time i loaded imovie 08, but i cant find an option to do it again.
    and thre is no info in any apply help file or the support pages, only how to import photos from iphoto.
    stupid! or is it me being stupid

    My iphoto video formats are the kind that my DMC Panasonic Still camer Shoots.
    That doesn't really help, try opening them in QT/inspector and seeing what video and audio compression is used.
    My point is, they are the same format as the ones that were imported 3 days ago.
    Are you sure, your camera may be capable of taking more than one type of video, does im08 still recognise the video from 3 days ago
    Is there a manual way to udate the iMovie video library from iPhoto when new videos are added to iPhoto?
    Have you tried dragging the video from iphoto to the desktop and then in im08 using file/import movies

  • How to import/export   from d2k

    hi
    hi please could you help me in how to import/export from d2k.
    M.P.Kiran Kumar

    FUNCTION open_ldr RETURN varchar2 IS
    out_file Text_io.File_Type;
         v_filename varchar2(255);                              
    Begin
    out_file := Text_IO.Fopen('C:sqlldr.ini', 'R'); /* create a file so that u can store sqlldr path first time it wont be there so write the path after verifying */
    text_io.get_line(out_file,v_filename);
    --message(v_filename);
    return(v_filename);
    Exception when others then
         --message('Check For Sqlldr73.exe or Sqlldr*.exe');
    v_filename := get_file_name(File_Filter=>'sqlldr Files (*.exe)|*.exe|');
    out_file := Text_IO.Fopen('C:\sqlldr.ini', 'W');     
         Text_IO.Put(out_file,v_filename);
    Text_IO.Fclose (out_file);
    if v_filename is null then
         Message('Please Select The Sqlldr Path ');
         Message('Please Select The Sqlldr Path ');
         raise form_trigger_failure;
    end if;
    return(v_filename);
    End;
         Declare
              The_userid varchar2(100):='';
              The_Password varchar2(100):='';
              The_connectstring varchar2(100):='';
              Con_Info varchar2(100):='';
              the_command varchar2(200):='';
              v_filename varchar2(100);
              cursor c1 is select tname from <table_name > /* create a table in ur schema and put all the tables which u want to export */ where tabtype = 'MASTER';
         Begin
              v_filename:=open_ldr;
         The_userid := Get_Application_Property(UserName);
                   The_Password := Get_Application_Property(Password);
                   The_connectstring := Get_Application_Property(Connect_String);
                   Con_Info := The_userid||'/'||The_Password||'@'||The_connectstring;
                   for c1rec in c1 loop
                   C2K_TRUNC_HLL_MASTERS(c1rec.tname);
                   the_command := v_filename||' Control=c:\'||c1rec.tname||'.ctl userid='||Con_Info; -- Change This According To The Path
                   -- message(the_command);message(the_command);
    Host(the_command);
                   End Loop;
                   the_command := v_filename||' Control=c:\control'||'.ctl userid='||Con_Info; -- Change This According To The Path
                   host(the_command);
                   Exception When Others Then
                        Message('Error'||' '||sqlerrm);
                        Message('Error'||' '||sqlerrm);
         End;
    If u have any problems please contact me on [email protected]
    furnish the details properly .
         

  • How to import data from excel or csv files to Oracle table

    hello everybody,
    I am new here and new in Oracle. I would like to know the steps how to import data from excel or csv files to Oracle table.
    Let say I already have table inside the Oracle. Then my user give me the sets of data inside the Excel Worksheet.
    So, how can I import the excel data into Oracle table.
    Thank you in advance.
    cheers,
    shima

    Even easier. Download JDeveloper 11G from this site.
    Set up the database connection, right click on the table, select Import->Excel and specify your file to load it. On the import pop-up, you must view and update each tab indicating Columns, Data Types, and DML.
    Columns -- move the selected columns that you want to load to the box on the right
    Data Types -- select column name from second column to which the data for each column of the import file should load
    DML -- click this tab to generate the INSERT SQL
    Once done click 'Insert'

  • HT204414 how to merge my iPhoto Library into my Photos System Library or how to import photos from iPhoto to Photos?

    Can anyone tell me how to merge my iPhoto Library into my Photos System Library or how to import photos from iPhoto to Photos?

    How many did you trash at one go? iPhoto will baulk and possibly corrupt if you try trash too many at one go. Expereinced users recommend getting rid of them in batches of about 100 or so.
    What's your plan for the remaining images in the iPhoto Library (the 2k photos and 4 videos)?
    Regards
    TD

  • I cant see how to import photos from my camera

    I watched a video on how to import photos from a camera using Adobe Photoshop, based on this video I have downloaded the Adobe Photoshop Elements 10 but the Command G function to import photos from my camera doesnt appear to exist

    Hi Barbara
    I see that this problem with creating a sub folder names as the shooting date has been an issue since 2011 as I found out
    on the following forum
    http://forums.adobe.com/message/4055234
    I am struggling to see why this is occurring with purchased software
    Regards
    Danny Dutton
    Hi Barbara,
    Your information has been very helpful and I do appreciate your kind assistance
    I have contacted iTunes and they are going to refund my money which is great.
    I went to store and purchased Adobe Photoshop and Premier (single package) Elements 10 s. I am using a new iMac with OS 10.7.4
    The Photoshop installed OK but she I chose to import photos from my camera and chose to create new folder named as the date shot a new folder is created but it totally shows the wrong date, I am sure we are not in 1970 or 1999 LOL. This happened with both a Canon Powershot and a Canon EOS camera. This problem does not occur with Picasa which works perfectly and does beg the question why I am persisting with Adobe products!
    The Premiere (on the same disk as Photoshop) will not install and I get the following error message
    Exit Code: 7

  • How to import photos from new Apple Photos app.. ?  Iphoto no longer exists

    How to import photos from new Apple Photos app.. into Elements  (organizer ??)?  Iphoto no longer exists
    Otherwise I cannot use the Adobe program.

    srumsey88
    What program and version do you have on your Mac computer - Photoshop Elements and its Elements Organizer or Premiere Elements and its Elements Organizer?
    The nature of your question suggests that you may be dealing with Photoshop Elements and its Elements Organizer. If that is the case, please post your question in the Adobe Photoshop Elements Forum.
    Photoshop Elements
    Your thread has been posted to the Adobe Premiere Elements Forum (video editing)..
    Please clarify your program.
    Thank you.
    ATR

Maybe you are looking for

  • HT4623 iOS7 downloaded and now my screen is all white

    I downloaded iOS7 and now all of a sudden my screen is all white, nothing happened to the phone during installation it literally sat right next to me the whole time. What do I do? My lock button is broken so I can't reset it.

  • MBAM 2.0 Agents with MBAM 2.5 Servers

    Hi All, Does anyone know whether MBAM 2.0 agents will continue to work with MBAM 2.5 infrastructure? We are in the process of planning an upgrade to 2.5 for the infrastructure but I cannot find anything that states whether there is an absolute requir

  • Safari Not Displaying All Images On Web Page

    When I look at a web page in Safari on my iPhone 3GS, not all of the images on the page load. Instead, I see little blue squares with question marks in them. However, if I look at the same web page on an iPhone 4, the images DO load. Why is this happ

  • When I receive a phone call it also rings my husbands phone?

    When I get a phone call on my IPhone 5c it also rings on my husbands iPhone 4s and vice versa?

  • TV tuner settings

    I have a Pavillion Elite HPE 440f with Windows 7 and a TV tuner.  I have satellite TV. The TV tuner only searches channels 2,3 & 4 for a signal but it is on another channel. How can I get the tuner to search other channels for the signal?