A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Increasing a variable on release

  1. #1
    Member
    Join Date
    Mar 2007
    Posts
    31

    Increasing a variable on release

    Hello,
    in my first frame i have

    var picnumbers = 1;

    i have a button that i want to use to increase this variable by multiplying it by 4.

    ive looked on the web and cant find it!

    thanks a lot for your help

    junior

  2. #2
    Senior Member
    Join Date
    Jan 2006
    Posts
    140
    on(release)
    {
    picnumbers = picnumbers * 4;
    }

  3. #3
    Member
    Join Date
    Mar 2007
    Posts
    31
    brilliant, i thought it was that.. i just put it under a line instead of on top of one.

    another question if i may,

    i am running an external class too,

    my first frame.
    var picnumbers = 1;
    butGo.onRelease = function()

    {
    simpleSearch.doSearch(tag.text);
    }
    this is my button atm and it increases pic numbers

    on (release) {
    simpleSearch.doSearch(tag.text);

    picnumbers = picnumbers * 4;
    myTextbox.text = picnumbers;

    }
    this is the first line of my external class that i am using..

    public static var NUM_RESULTS:Number = 1;
    how do i get that number 1 to become picnumbers?

  4. #4
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,836
    A shorter way of doing it is:
    picnumbers *= 4;

    [Edit] What is the name of the class file? To get something from a class file you do this:
    code:
    var blah:ClassFileName = new ClassFileName();
    something = blah.variable;


    Something like that.
    Last edited by swak; 04-17-2007 at 10:30 PM.
    .

  5. #5
    Member
    Join Date
    Mar 2007
    Posts
    31
    i want the classfile to be able to read from my main flash movie..

    not the other wayaround..

    i am declaring picnumbers in the main movie, and want to, somehow, make the external class get the variable..

  6. #6
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,836
    Not sure.
    .

  7. #7
    Member
    Join Date
    Mar 2007
    Posts
    31
    bttt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center