• 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

    • XRECODE3 1.169 by Razvan Serea xrecode3 is a converter and audio-grabber which allows you to convert from mp3, mp2, wma, aiff, amr, ogg, flac, ape, cue, ac3, wv, mpc, mid, cue ,tta, tak, wav, wav(rf64), dts, m4a, m4b, mp4, ra, rm, aac, avi, mpg, vob, mkv, mka, flv, swf, mov, ofr, wmv, divx, m4v, spx, 3gp, 3g2, m2v, m4v, ts, m2ts, adts, shn, tak, xm, mod, s3m, it, mtm, umx, mlp to m4a, alac, ape, flac, mp3, mp4 (using NeroAAC), ogg, raw, wav, wav(rf64), wma, WavPack, mpc, mp2, Speex, ofr, ac3, aiff, tak, snd and Shorten formats. Command Line parameters are supported. XRECODE3 features: Works on XP, Vista, Windows 7, Windows 8, 10 32/64 bit versions and under Wine. Parallel conversion by utilizing power of multi-core CPUs. Support of embedded CUE sheets (for FLAC, WavPack, APE and TAK files). Support of mp4, mka chapters (can split mp4, mka by chapters to any supported format). Built-in Metadata editor with Cover Art support. Has support for LossyWav. Supports portable mode. Merge input files to one large audio file and create CUE sheet. Converting to many formats at once using "Multiple" output mode. Grabbing of multi-channel Audio CDs to the desired format at once. Informative and resizable UI suited even for netbooks. Extracting audio from flv, avi, mov etc. video files (multiple audio streams are supported). Can export/import Metadata to/from external file. Support for 24/32bit audio files. Multilanguage support. Currently program is available in Dutch, English, French, Japanese, Korean, Polish, Russian, Hungarian, Italian, Spanish, Spanish Traditional, Swedish, Brazilian Portuguese, German, Finnish, Bulgarian, Czech, Danish and Chinese (simplified) languages. What's new in XRECODE3: Native 64bit support. Added support for DSD/DST and DFF formats (including handling of SACD ISOs). Added option to extract audio without transcoding. Added option to encode several files to one multi-channel file. Added option to split file into individual track-per-channel for all available output formats. Added option to merge files per folder. Output and Metadata settings are now output format specific. Enhanced Metadata settings. Added support for multiple Cover pictures in Metadata editor. Added 32bit int/float output for formats which support them (e.g. WAV). Added dithering option in Output Settings. Added option to use EBUR128 in Normalize. Added option to Album Mode Normalize. Added option to configure Matrices under Output Settings. Added more output file pattern elements. Tabbed UI. CUE files are now displayed more nicely. Enhanced Shell Extension. XRECODE3 1.169 changelog: FIX: resolved an issue where playlist file names was created with 2 dots before the file extension. FIX: fixed issue with encoding some files to ac3 format. Download: XRECODE3 v1.169 (64-bit) | Portable | ~30.0 MB (Shareware) Download: XRECODE3 v1.169 (32-bit) | Portable Link: XRECODE3 Homepage | XRECODE3 Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • So... Tesla fails, SpaceX fails, not Starlink... I guess karma is a bitch...
    • Basically, they can hire someone with less skill for a lower wage, for example from India, and use AI to bring that employees output up to the level of someone more experienced and expensive. It’s a broad cost-cutting strategy, and plenty of companies are already doing it. With AI involved, the employee just needs to check that the AI's results aren’t complete junk. They don’t actually have to know how to produce the work themselves. You just get one high level employee to triple check who does. The workflow looks like this: AI generates the content, a low-skilled worker filters out anything clearly broken or wrong, and a high-skilled worker gives it a final pass. Instead of hiring a full team of experts, companies can rely on a few at the top while AI and cheaper labour handle the bulk of the process.
    • Aah, always the evil terrorist group. Why not just the Russians, they're worse than any terrorist organisation.
    • LG Electronics sees profit dip but boosts shareholder returns by Paul Hill LG Electronics (LGE) has reported consolidated sales of 20.74 trillion Korean Won (approximately $15.14 billion USD) and an operating profit of 639.4 billion Korean Won (approximately $466.75 million USD) for the second quarter of 2025. The firm saw both its revenue and operating profits decline year-over-year due to external factors such as US tariff policies, ongoing geopolitical issues in the Middle East, and a slowdown in consumer spending. While the company has faced challenges, the company is aiming for what it called qualitative growth by strengthening its subscription services, direct online sales, and business-to-business (B2B) segments. Key areas of growth for LGE include automotive electronics, heating, ventilation, and air conditioning (HVAC) systems, and the webOS platform. The US tariffs are a major headache for companies around the world, given the size of the market there and President Trump's demands for bringing manufacturing to the States. To combat the rising US tariffs, LGE is trying to optimize global production and refine its market-specific approaches for premium and mass-market products. While the company’s profits dipped, it announced an interim dividend of 500 Korean Won (approximately $0.37 USD) per share for both common and preferred, with another payout later in the year that should take the total for 2025 to at least 1,000 Korean Won (approximately $0.73 USD). You must be holding the stock on August 8, 2025, to get the payout on August 22, 2025. The firm also said it will cancel 761,427 common treasury shares on July 31, 2025, making shares more scarce which could increase the value of remaining shares for investors. In terms of LGE’s various business divisions, things were mixed. Its Home Appliance Solution (HS) business achieved year-over-year sales growth, maintaining profitability, thanks to a dual strategy for premium and volume segments and growth in online sales and subscriptions. Its Media Entertainment Solution (MS) business experienced declines in sales and operating profits with the latter turning negative due to market uncertainties and stiff competition. Its Vehicle Solution (VS) business showed growth in sales and operating profit thanks to increased orders from European automotive makers. Finally, its Eco Solution (ES) business saw domestic sales increase, but overseas sales growth was limited due to US tariffs. This led to a slight year-over-year drop in operating profit due to higher costs. Image via Depositphotos.com
  • Recent Achievements

    • Week One Done
      Itbob513626 earned a badge
      Week One Done
    • One Month Later
      Itbob513626 earned a badge
      One Month Later
    • Rookie
      EdwardFranciscoVilla went up a rank
      Rookie
    • Week One Done
      MoJo624 earned a badge
      Week One Done
    • Collaborator
      aeganwn earned a badge
      Collaborator
  • Popular Contributors

    1. 1
      +primortal
      619
    2. 2
      ATLien_0
      243
    3. 3
      Xenon
      160
    4. 4
      Michael Scrip
      124
    5. 5
      +FloatingFatMan
      123
  • Tell a friend

    Love Neowin? Tell a friend!