• 0

ActionScript 3 Help


Question

I really don't get something.

How come when I define a variable that's movie clip type but it's actually just an image of something, i.e.

var a:aMC;

a = new aMC();

addChild(a);

And when I initially set its value to its x, y, alpha position, i.e.

a.x = 1;

a.y = 1;

a.alpha = 0;

Alright, then I did an alpha tween from 0 to 1 to it (aTween is defined already),

aTween = new Tween(a, "alpha", Regular.easeOut, a.alpha, 1, 5, true);

Later on when I make a MouseEvent where if you click on this object, the function is called and inside the function, this alpha tween runs:

aTween = new Tween(a, "alpha", Regular.easeOut, a.alpha, 0, 5, true);

OK, so the tween works fine, but then it doesn't stay 0 after it's done. It's like the flash has restarted or something and the alpha goes back to 1.

What am I missing here? Hope this makes sense.

dL

Link to comment
https://www.neowin.net/forum/topic/732706-actionscript-3-help/
Share on other sites

5 answers to this question

Recommended Posts

  • 0

I think I know why, but don't know how to fix it.

Since the function inside changes to 0, but because once the function finishes the values go back to the stage value, which was changed to 1 from the first tween.

How do I go about and forcing that to 0 after the function is called?

dL

  • 0

If you guys are confused of what I just said, this is the file

http://www.sfu.ca/~dsl2/iat235/asn3/iat235_asn3_final.fla

Play the movie and click on the "What" cloud button and you'll get what I mean.

All the items should disappear after alpha tweening to 0, but then it appears again which it shouldn't. Why is that?

The function is called "what".

Your help is much appreciated!!

dL

  • 0
  dL said:
I think I know why, but don't know how to fix it.

Since the function inside changes to 0, but because once the function finishes the values go back to the stage value, which was changed to 1 from the first tween.

How do I go about and forcing that to 0 after the function is called?

dL

If that is indeed the problem, then all you should have to do is add a listener to listen for the end of the tween, and explicitly set the value of a to 0

aTween.onMotionFinished  = function()  {
a.alpha = 0;
}

But you shouldn't have to do it this way. The alpha should stay at 0 when the tween is done. Nevertheless, I'm sure there is a reasonable explanation. When the value goes back to 1, does it tween to 1 within your 5 seconds, or does it happen instantly?

Edited by Mr. Bean
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • I happen to try it today not knowing about the update and was happily surprised; it is great.
    • Hello, Hardware Support Applications are a special kind of Microsoft Store app and have to go through additional checks and certifications because they can communicate directly with their driver, which means that a vulnerability in one of them could allow an attacker access to kernel space memory through the HSA ←→ device driver interface.  In other words, a BYOVD (bring your won vulnerable driver) attack, but with the HSA being used as an extra step. Remember, the Microsoft Store is strategic to Microsoft's long-term goals: they see it as the means to get the same 30% of every application sale that Apple and Google get through their stores, which is why it has been a fixture of Windows since Windows 8 was introduced in 2012 despite a low adoption rate.  Microsoft cannot afford to have anyone get an app through their store which causes a security issue for their end users.  Even if the app was written by and uploaded to the Microsoft Store by a partner, it is Microsoft's name on the store, and they are the ones that will have reputational/brand damage if they allow something malicious into their store. Regards, Aryeh Goretsky  
    • This is more from my childhood, when nickelodeon just launched and had to license shows to have something to air. Left a big an impact, but probably more emotion positive / childhood thing. Europe got the follow up season's decade's latter with the animation studio that did Air Bender but never licenses for the US. I miss the day's of longer intro's. Nier (PS3) Intro is epic, and was very unexpected.  PS1 Xengears was also epic and an amazing game.  
    • Sayan Sen, do you think one day an image of the Windows Vista desktop or the wallpaper could be used in the primary image of an article? (When I think of CDs and DVDs I think of that release of Windows and of earlier releases; it is the one that debuted IMAPI 2.0 and other features.)
    • Big fan of EAC Here's a good non-default naming scheme I found on the web (can't take credit) File Name Scheme - %albumartist%\%year% - %albumtitle%\%tracknr2% %title% Various Artists Naming Scheme - Various Artists\%year% - %albumtitle%\%tracknr2% %title% Also, I need test but there is a new flac.exe binary & dll you can drop in the folder to upgrade flac support. I did this pre EAC 1.8. EAC 1.8 did upgrade it to 1.4.3. Flac 1.5.0 came out this year. https://ftp.osuosl.org/pub/xiph/releases/flac/ I don't know how much of a difference / impact will make.
  • Recent Achievements

    • Week One Done
      Ricky Chan earned a badge
      Week One Done
    • Week One Done
      maimutza earned a badge
      Week One Done
    • Week One Done
      abortretryfail earned a badge
      Week One Done
    • First Post
      Mr bot earned a badge
      First Post
    • First Post
      Bkl211 earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      484
    2. 2
      +FloatingFatMan
      263
    3. 3
      snowy owl
      240
    4. 4
      ATLien_0
      227
    5. 5
      Edouard
      188
  • Tell a friend

    Love Neowin? Tell a friend!