import statement flash cs3 action script

Posted on 2007-08-06
Last Modified: 2012-06-27
Do I need an import statement at the beging of my actionscript to import a class or something so i can play a sound.  Im using flash cs3.
Question by:flashactions
    LVL 14

    Expert Comment

    Flash CS3 uses AS3, which is a whole lot more strict when it comes to the import statements. Which means that you really need to use the import statements. To make things easier, instead of importing individual things under display:
    you can do:
    import flash.display.*
    to import everything under display.

    For sounds, you'll have to do import*

    LVL 1

    Author Comment

    does that make the file size larger?  I was reading this book and in the chapter abou how to play a sound it did not mention the need for the import statement. the book said to play a sound using action script you need to import it to the library then give it a linkage name.  then use this code.  

    var mySound:LinkageName = new LinkageName();

    now that code wont work unless i use the import statement?   Cause I did make buttons have sounds attached to them and I never used the import statement and they played anyway.  But yeah let me know     thank you
    LVL 1

    Author Comment

    yeah  I ended up getting the sound to play when i pust the space bar.  It was nice and it worked with or without the import statement.  Im thinking that when its published the flash cs3 adds them in.  But I would like to clarify why it works without it.
    LVL 14

    Accepted Solution

    I'm not completely sure how Flash CS3 works since I'm a flex user. It's highly possible that flash would automatically do things to help make things simpler for the user since flash was made with designers (non-programmers) in mind.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
    I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
    The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
    The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now