Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


import statement flash cs3 action script

Posted on 2007-08-06
Medium Priority
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
  • 2
  • 2
LVL 14

Expert Comment

ID: 19641749
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 flash.media.*


Author Comment

ID: 19641818
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

Author Comment

ID: 19642083
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

trigger-happy earned 2000 total points
ID: 19642632
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.


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

578 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