A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Putting two variables together - How?

  1. #1
    Junior Member
    Join Date
    Jan 2008
    Location
    Somerset, UK
    Posts
    25

    resolved [RESOLVED]Putting two variables together - How?

    Hey all, these forums are really good, so I'm back for more!

    Basically, what I want to do is in the title.
    I need to put two variables together, amongst other things to create one big variable that combines the lot.

    This is what I'm working with:
    Code:
    circle.graphics.lineStyle (3, 0xFF0000|(circlenum*20 <<64);
    This is just an example, the parameters, and names are made up. It's the color that I want to put together.
    -0xFF0000 is "Var1"
    -64 is "Var2"

    Simply, I need to be able to do it liek this;
    Var1|(circlenum*20 <<Var2

    Anyone tell me how this is done?
    Thanks in advance!
    Last edited by raven3962; 02-09-2008 at 06:59 AM. Reason: Resolved

  2. #2
    Junior Member
    Join Date
    Jan 2008
    Location
    Somerset, UK
    Posts
    25
    I've just figured it out, I'll put it here so others can see it:

    First, the variables are made further up the script.

    Var1 = 0xFF0000
    Var2= 64

    basically, this is the code:

    Code:
    circle.graphics.lineStyle (3, Var1| (circlenum*20 <<Var2);
    
    Makes: (that flash sees it as)
    circle.graphics.lineStyle (3, 0xFF0000| (circlenum*20 <<64);
    I hope this helps someone out.

    Thanks!

  3. #3
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    So wait. You were working with bit shifting and the drawing API, but didn't know how basic variables worked?

    What kind of a background do you come from?!

  4. #4
    Knows where you live
    Join Date
    Oct 2004
    Posts
    944
    Uh... What does shoving a variable 64 bits up a 32 bit ARGB do?
    The greatest pleasure in life is doing what people say you cannot do.
    - Walter Bagehot
    The height of cleverness is to be able to conceal it.
    - Francois de La Rochefoucauld

  5. #5
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    Quote Originally Posted by MyFriendIsATaco
    So wait. You were working with bit shifting and the drawing API, but didn't know how basic variables worked?

    What kind of a background do you come from?!
    Hah, welcome to the forum... Just open your eyes a bit more and you'll see that 70% of the people posting a problem are trying to do a really complex application but they have no idea what a variable is or how an "if" statement works... I know, it's funny...



    | Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro |
    WebLog: http://blog.wisebisoft.com/ |
    | Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
    |
    Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/
    | By perseverance the snail reached the ark. |


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