Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Class Import Question


Hi,

if I have one class that instanciates a class (lets say for example a Bitmapdata object), then passes this instance to another class, in order to type-check this object, I need to import the BitmapData class into the class that the instance is being passed into.

As far as I'm aware, this doesn't mean the class is actually imported for a second time, so in terms of memory/processor use, this isn't a problem, but is there any disadvantage to doing this (potentially importing the same classes repeatedly throughout a project)?

Thanks




ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 02-20-2007, 03:59 PM


View Complete Forum Thread with Replies

Sponsored Links:

Import Entire Class Directory Vs Specific Class
First off i've already tried searching for the answer with no luck.

Is there any benefit to only importing the specific classes you need as opposed to importing the entire class directory?

Example:
import flash.display.Loader;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
import flash.display.Sprite;
import flash.display.BlendMode;
import flash.display.Bitmap;
import flash.display.BitmapData;
etc.....

vs
import flash.display.*;


Id like to clean up my code but not at the expense of performance....or does this just increase compile time?

View Replies !    View Related
Class Import
Hello,

In a class file, I wish to import another class, which file is in another folder.

For example: Class1.as is in folder1 and Class2.as in folder2. Folder1 and folder2 are at the same level.

How can I import Class2 in Class1?


PHP Code:




/root/
    -> /root/folder1/
        -> /root/folder1/Class1.as
    -> /root/folder2/
        -> /root/folder2/Class2.as

View Replies !    View Related
How To Import A Class
hi all,

i have a folder named flashTemplate in this folder i have two folders 1). source 2). script and a folder inside script folder is classes

can anyone please guide me how i can import a class from classes folder in a fla file located in source folder.

thanks in advance
Kishor

View Replies !    View Related
Import And Run Custom Class
Hi All
just trying to wrap my fingers around this as3 stuff, what a change from as2. So I have gone and written a small class that loads a image and zooms in (scales the image) and lets you drag it. I have it as a package and class it works when the class is called throught the document class. I want to be able to use this in other projects and distribute it so this is not practicle. I also additionaly want it to except parameters such as the image to load and the size and amount to zoom. the problem I have it is that when not using it as a document class and improrting it I cant seem to get it to display. I have this code in my fla

Code:
import zoomer
var myzoomer:zoomer = new zoomer();
var zmr:Sprite = new Sprite();
zmr.addChild (myzoomer)
and this is my class that currently sits in the same directory as my fla.

Code:
package zoomer {
import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
import flash.geom.Rectangle;
public class zoomer extends Sprite {
private var _loaderHolder:Sprite = new Sprite();
var _loader:Loader = new Loader();
public var _zTogle:Boolean = false;
function zoomer () {
loadImage ("assets/images/2.jpg");
}
public function loadImage (u:String) {
_loader.contentLoaderInfo.addEventListener (Event.COMPLETE,onComplete);
var request:URLRequest = new URLRequest(u);
addChild ( _loaderHolder );
_loader.load (request);
_loaderHolder.addChild (_loader);
_loaderHolder.scaleX=.5;
_loaderHolder.scaleY=.5;
var square:Sprite = new Sprite();

square.graphics.beginFill (0xFF);
square.graphics.drawRoundRect (0, 0, 200, 200, 10, 10);
square.graphics.endFill ();
addChild (square);
_loaderHolder.mask=square;
buildBtn ();
}
function buildBtn () {
var square:Sprite = new Sprite();
square.graphics.beginFill (0xFF);
square.graphics.drawRoundRect (0, 0, 20, 20, 10, 10);
square.graphics.endFill ();
addChild (square);
square.addEventListener (MouseEvent.MOUSE_DOWN, zBtnDown);
}
private function zBtnDown (event:MouseEvent):void {
var sprite:Sprite = Sprite(event.target);
if (!_zTogle) {
_loaderHolder.addEventListener (MouseEvent.MOUSE_DOWN, mouseDown);
_loaderHolder.addEventListener (MouseEvent.MOUSE_UP, mouseReleased);
_loaderHolder.scaleX=1;
_loaderHolder.scaleY=1;
_loaderHolder.x=-100
_loaderHolder.y=-100
_zTogle=true;
} else {
_loaderHolder.removeEventListener (MouseEvent.MOUSE_DOWN, mouseDown);
_loaderHolder.removeEventListener (MouseEvent.MOUSE_UP, mouseReleased);
_loaderHolder.scaleX=.5;
_loaderHolder.scaleY=.5;
_loaderHolder.x=0
_loaderHolder.y=0
_zTogle=false;
}
}
function mouseDown (event:MouseEvent):void {
var myRectangle:Rectangle=new Rectangle(-100,-100,100,100);
_loaderHolder.startDrag (false,myRectangle);
}
function mouseReleased (event:MouseEvent):void {
_loaderHolder.stopDrag ();
}
public function onComplete (ev:Event):void {
}
}
}
not sure what I am missing to make it work I am initiating it like I have other class. any help would be super

View Replies !    View Related
Class Import Errors
Hi all,

I keep getting an error when I try to import my error classes to my application.

My relevant file structure is thus:

[Application_root]
__-[classes]
____-[errors]
______-ErrorType1.as
______-ErrorType2.as
______-ErrorType3.as
__-[Methods]
____-methods.as
__-Main.fla

By default, I have Flash look for my class files in this order:
.
./classes


ErrorType#.as contains:

class error.ErrorType#
{
//code
}

methods.as contains:

var e1:error.ErrorType1
if blah > blah2
{
throw error.ErrorType1
}

catch(e1:error.ErrorType1)
{
//error code 1
}

(repeat the above for each type of ErrorType#)

This code works fine (if it made sense to anyone)

My problem occurs when I try to simplify the code by doing an import of my error directory so I don't have to explicitly reference the [errors] directory in each function ala:

import errors.*

From what I understand, this should tell Flash to reference the [errors] directory when looking for my class files. Since Flash is set to look for said files in both . and ./classes it *should* be able to find the [errors] directory under my [classes], should it not? Which means I should be able to change my methods.as file to:

import errors.*

var e1:ErrorType1
if blah > blah2
{
throw ErrorType1
}

catch(e1:ErrorType1)
{
//error code 1
}

Except that when I do this, I get a failure to reference ErrorType1.as

Even importing each class directly ala

import errors.ErrorType1
import errors.ErrorType2
import errors.ErrorType3

and so on yield the same failure.

I'm not sure what I'm doing wrong here. All the tutorials I've read say this should work, but even when I replicate them I'm getting the same error.

Thanks in advance for any advice. New at this and pulling my hair out.

View Replies !    View Related
Import Class Not Working
Hey,

Im using actionscript classes which are contained in the follwoing sub folders from my flash doc.... classes/hello/hello2/code1.as and classes/hello/hello2/code2.as

im currently importing (or so i think) them using....

Code:
import hello.hello2.code1
import hello.hello2.code2
"The class or interface 'hello.hello2.code1' could not be loaded......."

do i have to link to them some how or does that action script code do it all for me?


Regards

Al

View Replies !    View Related
Class Import Concern
import flash.display.*; -versus- import flash.display.MovieClip;

Does "import flash.display.*;" in any way increase my file size on run, or slow it down at all if I declare this in my class file? (as opposed to using "import flash.display.MovieClip;")

Because currently, I'm using:

ActionScript Code:
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import flash.net.*;
import flash.filesystem.*;
import fl.managers.*;

I'm just concerned there *might be some performance hit. Do I need not be worried?


Heck, if I could, I'd just use:

ActionScript Code:
import flash.*;
import fl.*;

But it won't compile.

View Replies !    View Related
Class Import Question
I'm just wondering what is generally acceptable when importing classes when scripting in AS3. Whether or not it is good practice to use a wildcard (*) to import all subclasses of a specific type or to only import the ones being used.

eg.


Code:
import flash.display.*;
or


Code:
import flash.display.Sprite;
import flash.display.Loader;
etc....
Also, if a wildcard is used does it increase file size or does flash still only import the classes actually being used?

Hope that makes sense

View Replies !    View Related
Base Class Import
where can i find a list of imports for classes? such as:

import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Point;


thanks

View Replies !    View Related
Class Import Error (?)
Hello all. I'm having problems importing multiple classes in MX 2004. I don't have the pro version.
Whenever I try to import more than one class i get the following error:

**Error** Scene=Scene 1, layer=classes, frame=1:Line 6: The class 'node.as' cannot be imported because its leaf name is already being resolved to imported class 'tabset.as'

Where tabset is the first class and node is the second. If i try to import a third, it throws the error twice.
The class appears to load and I can use it, but I want this error to go away. Anyone else run into this??

Thanks!

View Replies !    View Related
Import Main In Class
I'm wondering if this would work and if it does if its bad programming practice or not. I am trying to do things right and don't want to develop bad habbits...anyway if I have a class with a button and I want that button to call a function in main (the main document class) could I import main to that class so it has access in a handler to call the function in main? I'm trying to figure out a way to have button panels (a message I left here earlier) control different aspects of a game, ie..startOver, Quit, etc...I know I can create the buttons in main and it will work but I want to encapsulate them in functional 'button' panels. Since the main functionally of the game lies in 'main' how can I encapulate the button panel(s) with the appropreate buttons to control functionallity in main? I'm not looking for someone to give me the code...just someone with more Class knowledge to steer me in the right direction. THANKS!

View Replies !    View Related
Import Tween Class
Hi. I am new at using actionscript, and I am having a bit of difficulty with Flash MX and importing tween class.
I have typed in this code:
import mx.transitions.Tween;
import mx.transitions.easing.*;

and this is the response I get:
Scene=Scene 1, Layer=actions, Frame=1: Line 1: ';' expected
import mx.transitions.Tween;

Scene=Scene 1, Layer=actions, Frame=1: Line 2: ';' expected
import mx.transitions.easing.*;

Every resource I go to tells me that my code is correct. Does anyone know what I am doing wrong?

View Replies !    View Related
AS2 Error Class Import
I dont have a clue


Code:
import mx.managers.DepthManager;
a_btn.onRelease = function() {
b_btn.setDepthTo(DepthManager.kTop);
var b_depth:Number = b_btn.getDepth();
trace(b_depth);
}

b_btn.onRelease = function() {
a_btn.setDepthTo(DepthManager.kTop);
var a_depth:Number = a_btn.getDepth();
trace(a_depth);
}
I get the following Error Code

Code:
Error:
C:Dokumente und EinstellungenBesitzerLokale EinstellungenAnwendungsdatenMacromediaFlash 8deConfigurationClassesmxmanagersDepthManager.as: Zeile 193: Keine Eigenschaft mit dem Namen '_topmost' vorhanden.
if ( depthFlag == mx.managers.DepthManager.kTopmost) o._topmost = true;

Anzahl der ActionScript-Fehler: 1 Gemeldete Fehler: 1
Any1 know this??

It is German but I guess it is the same on English ...

I am a bit lost, coz i reinstalled me Flash and got the same ???!!!

any help is much appreciated

View Replies !    View Related
[AS3] How To Import And Use My Custom Class?
Here is an example. Assuming that I have 2 classes: Main.as and Calculator.as

I want to import my Calculator.as into my Main.as so I could use its functions.


ActionScript Code:
//Calculator.aspackage {public class Calculator {public function Calculator(){}public function tripleValue(a:int):int{return a+a+a;}}}//Main.aspackage {public class Main {public function Main(){//tripleValue(8); //how to call the function "tripleValue" in Calculator.as}}}


edit: I found the solution, but not sure whether its efficient or not.


ActionScript Code:
//Main.aspackage {public class Main {public function Main(){var abc:Calculator = new Calculator();var i = abc.tripleValue(8);trace(i);}}}

View Replies !    View Related
AS2 Class Import - Outputerror - PLZ Help
Hi, im new to Ultrashock and i started AS2 OOP few days ago.

There is one Problem i cannot solve.

1. I got my Main Movie called "KlassenTest.fla".
There is a MovieClip on the Stage called "testmc".

2. I got a Class called "dt_moveclip.as" in folder called "classes".

Here's the code of the Main Movie:


ActionScript Code:
import classes.dt_moveclip; // (could use "classes.*" too
 
var mover = new dt_moveclip("testmc");
mover.moveme(testmc._x,testmc._y,testmc._x,testmc._y,300);


The code of the class looks like this:


ActionScript Code:
class dt_moveclip {
    var myMC:MovieClip;
    var Sizeaccel:Number = 0.8;
    var Sizeconvert:Number = 0.2;
    var Sizestep:Number = 5;
   
    function dt_moveclip(passed_mc:MovieClip)
    {
        myMC = passed_mc;
    }
                ....


When I try to start the Movie, it returns following in the Output Window:
Its in german, i try to translate the Output...


**Error** (path)classesdt_moveclip.as: Line 1: The currently compiled class, 'dt_moveclip', is not eval with the imported class, 'classes.dt_moveclip'.
class dt_moveclip {

Number of ActionScript-Errors: 1 Known Errors: 1


Could anyone help me out plz, I dont know how to get out of this.. i searched the whole internet, found nothing..

THX

View Replies !    View Related
Question About Import Class
Hi,
In a timeline-frame, i make this


ActionScript Code:
Import com/string.SuperString
trace(new SuperString())
output
[object Object] --- Good :)

So, on the next frame, i make this

ActionScript Code:
trace(new SuperString())
output
undefined --- damn :(


He work if i re-write Import com/string.SuperString to the keyframe.
Myquestion is : What hapenned ? i must import my function in every frame where i use it ?

View Replies !    View Related
[as2] Import Class Fustrations
Getting a bit fustrated with Flash MX 2004 and importing classes.

I have a class:

ActionScript Code:
class framework.service.Service {}

Which is extended by

ActionScript Code:
import framework.service.Service;
class com.firstflash.service.FirstFlashService extends Service {
}

I get this error message when checking syntax on the 2nd class
"FirstFlashService.as: Line 2: The class 'framework.service.Service' could not be loaded.
class com.firstflash.service.FirstFlashService extends Service {

Total ActionScript Errors: 1 Reported Errors: 1"

If i don't try to extend the class, both files don't have any errors reported by flash.
Any1 got any ideas?. This works in other languages but for flash it just doesn't seem to go.

thanks

View Replies !    View Related
AS 3 Class Won't Load/import
Using AS3, I'm trying to get a flv component to disappear after tit finishes playing. So I set up an event listener for the flv(flv1).

I keep on getting this error message: 'The class or interface 'fl.video.VideoState' could not be loaded.' It's a standard, already built class, why won't it load/import?
Below is the AS3 I wrote.

Code:

import fl.video.*;
import fl.video.VideoState;

import fl.video.VideoEvent;

this.container_1.flv1.addEventListener(VideoState.STOPPED, hideVideo);
function hideVideo(event:VideoState):void
{
this.container_1.flv1.visible = false ;
}

View Replies !    View Related
Import Class Questions
Greetings Yall,

I have three quick questions on using external classes.

Question One
+-----------------------+
I know you can import all the classes in a folder by useing somthing like this

Code:

import com.redletter.utils.*;

But I am wondering if you can use a similar statement and have it import all of the classes in the sub folders as well, or will this already do that?

(Here it comes. Number 2 that is..)

Question Two
+-----------------------+
It has never been clear to me weather you need to always keep external class files with your swf, or if you only need them for publishing. I always assumed you need them in your swf directory but in a it confused now.

(Oh no, he has another dumb question for us)

Question Three
+-----------------------+
If you setup the class path like lee showed us in the using external classes tutorial do you need the classes once you publish the files?

Thanks,
-Edward

View Replies !    View Related
Dynamic Class Import
I know i can do this in PHP, i looked around an AS2 programmer's guide but couldn't find anything like it...

In php i can include at runtime a php file. I wonder if you can include at runtime, using a variable file name, an action script class file.

My problem is i want to create a game that is quite big actually and i'd need to create classes on the spot and these classes could be anything that i declare outside the flash player :

Account, land, player, farm, house, sword, etc... Right now, my php version of this game which is page by page based is quite big and i have a very small number of classes (38 of them :P ) but it will grow. I'd like to put that into flash to stop the page refresh and offer some kind of interface at the same time...

Can it be done? Can we dynamically include and create classes in Flash?

View Replies !    View Related
Tween Class Import Error
Hi, this is a strange one...

I have this code in my first line of my first frame,
import mx.transitions.Tween;

It generates the following compile-time error
**Error** Scene=julapy, layer=script, frame=1:Line 1: Syntax error.
import mx.transitions.Tween;

its strange because it works in another flash doc i created but not in the other. its like flash is not picking up the flash classes

any ideas would be humongously appreciated

View Replies !    View Related
Force Class Import On First Frame
Hello,

Built an fla with a preloader on frame 1 and the content on frame two. Obviously I'm importing my classes on frame two, but is there a way to force the import of one class on frame 1?

Thanks

View Replies !    View Related
N00B: Setting Up Class Import
Please, somebody, anybody, create a basic flash file with example packages and classes in different folders and include them in the flash file. Then zip it and upload so I can see what is going on! I don't know why I keep getting errors.

From my understanding I can create this file structure:
Flash>Packages>PackageName>PackageName.as
Flash>Packages>PackageName2>PackageName2.as
Flash>FlashFile.fla
SomeOtherFolder>FlashFile.swf

Then I just put this code in my FlashFile.fla:

ActionScript Code:
include Packages.PackageName.as;
include Packages.PackageName2.as;
I've also tried adding Flash>Packages to the class path.
And I've even:

ActionScript Code:
include PackageName.as;
And...

ActionScript Code:
include PackageName.*;
Which doesn't give me an error but I can't create any objects of that class.

ActionScript Code:
include PackageName.PublicClassName;
and all of these with Packages preceding it!

View Replies !    View Related
Custom Class Import And Instansiation
Hi All
just trying to wrap my fingers around this as3 stuff, what a change from as2. So I have gone and written a small class that loads a image and zooms in (scales the image) and lets you drag it. I have it as a package and class it works when the class is called throught the document class. I want to be able to use this in other projects and distribute it so this is not practicle. I also additionaly want it to except parameters such as the image to load and the size and amount to zoom. the problem I have it is that when not using it as a document class and improrting it I cant seem to get it to display. I have this code in my fla

Code:
import zoomer
var myzoomer:zoomer = new zoomer();
var zmr:Sprite = new Sprite();
zmr.addChild (myzoomer)
and this is my class that currently sits in the same directory as my fla.

Code:
package zoomer {
import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
import flash.geom.Rectangle;
public class zoomer extends Sprite {
private var _loaderHolder:Sprite = new Sprite();
var _loader:Loader = new Loader();
public var _zTogle:Boolean = false;
function zoomer () {
loadImage ("assets/images/2.jpg");
}
public function loadImage (u:String) {
_loader.contentLoaderInfo.addEventListener (Event.COMPLETE,onComplete);
var request:URLRequest = new URLRequest(u);
addChild ( _loaderHolder );
_loader.load (request);
_loaderHolder.addChild (_loader);
_loaderHolder.scaleX=.5;
_loaderHolder.scaleY=.5;
var square:Sprite = new Sprite();

square.graphics.beginFill (0xFF);
square.graphics.drawRoundRect (0, 0, 200, 200, 10, 10);
square.graphics.endFill ();
addChild (square);
_loaderHolder.mask=square;
buildBtn ();
}
function buildBtn () {
var square:Sprite = new Sprite();
square.graphics.beginFill (0xFF);
square.graphics.drawRoundRect (0, 0, 20, 20, 10, 10);
square.graphics.endFill ();
addChild (square);
square.addEventListener (MouseEvent.MOUSE_DOWN, zBtnDown);
}
private function zBtnDown (event:MouseEvent):void {
var sprite:Sprite = Sprite(event.target);
if (!_zTogle) {
_loaderHolder.addEventListener (MouseEvent.MOUSE_DOWN, mouseDown);
_loaderHolder.addEventListener (MouseEvent.MOUSE_UP, mouseReleased);
_loaderHolder.scaleX=1;
_loaderHolder.scaleY=1;
_loaderHolder.x=-100
_loaderHolder.y=-100
_zTogle=true;
} else {
_loaderHolder.removeEventListener (MouseEvent.MOUSE_DOWN, mouseDown);
_loaderHolder.removeEventListener (MouseEvent.MOUSE_UP, mouseReleased);
_loaderHolder.scaleX=.5;
_loaderHolder.scaleY=.5;
_loaderHolder.x=0
_loaderHolder.y=0
_zTogle=false;
}
}
function mouseDown (event:MouseEvent):void {
var myRectangle:Rectangle=new Rectangle(-100,-100,100,100);
_loaderHolder.startDrag (false,myRectangle);
}
function mouseReleased (event:MouseEvent):void {
_loaderHolder.stopDrag ();
}
public function onComplete (ev:Event):void {
}
}
}
not sure what I am missing to make it work I am initiating it like I have other class. any help would be super

View Replies !    View Related
Import Mx.log.Logger Class Not Compiling - HELP
Hi!

The actionscript file i am debugging has an import - "import mx.log.Logger" in it. I have installed Studio 8 professsional with ColdFusion. It is still not happy to compile my actionscript file.

What am i doing incorrectly? Please help!!!

View Replies !    View Related
Error 1046 In A Class After Using Import
hmmmmm, I give up. I want to use some component controls inside a class I have coded. I have used
import fl.controls.RadioButton;
but then I get a compile time error "1046 type was not found or was not a compile-time constant: RadioButton" on the line
private var button1_rb:RadioButton

What do I do?

View Replies !    View Related
Class Or Import Not Working Anymore?
I have this project that I had on ice for a long time. I just got asked to make it work again and am having issues with it.

I am using the lmc_tween.as class. My import looks like this and used to work fine.
#include "lmc_tween.as"
$tweenManager.broadcastEvents = true;

Now when I opened the project, it is no longer working. The files now is set to AS2 and player 8 and I am using the latest version of the class.

Any ideas why this might not be working how I can trouble shoot it to work?

Thanks a lot for any help with this!

View Replies !    View Related
Tween Class Import Not Working In MX?
Hi everyone, I just went over the motion tween tutorial for Flash MX, and every time I try to run the code, it pops up

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 1: ';' expected
import mx.transitions.Tween;

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 2: ';' expected
import mx.transitions.easing.*;

Can someone tell me why it's not working? Thanks.

View Replies !    View Related
Import Statement In A Custom Class
Hi,

i wrote a custom class. i tried to use tween class in my class but it gives error.

it start with like this



class TTB_2 extends MovieClip {

import mx.transitions.Tween;
import mx.transitions.easing.*;



Any solution ?

thanks.

View Replies !    View Related
Export/import Swf Class Method
dear all,
I need your help.

I just made a movieClip and associated to it a class with a method:'popolate'.
The movieClip works correctly inside the fla where I develop that movieclip.

Now, I'd like to import that movieClip in others projects, but when I import the movieclip runtime with loadMovie I can't execute the method.
It is like when exporting to swf, flash does not include the class file with the movieClip.

Can anyone help me?
Thanks, Dario.

View Replies !    View Related
Include Or Import Other Classes Inside Of Another Class?
I'm creating a component and a class for that component using the new 2.0 OOP methods. I need to use the Robert Penner movieclip Tween class calls with in my class, which means I have to import or include that class in order the use it. But I can't seem to find a way to do it. Both include and import return errors, stating that that it is not allowed within a class definition. Is this just not possible? Any help?

View Replies !    View Related
Maybe An Import Problem With Custom Event Class
Hi

I followed a few tutorials and read up on making custom event classes, I have tried a few approaches, this one by "ampo_webdesign" among others: http://board.flashkit.com/board/forumdisplay.php?f=102

But no matter how I cut it, I get a
Quote:




1203: No default constructor found in base class flash.events:Event




My code looks like this:

Code:
package dk.classes.events {

import flash.events.*;

public class CustomEvent extends Event {

public static const DONE:String = "instanceDone";
public static const XML_LOADED:String = "xmlIsLoaded";

public var val:Number;

public function CustomEvent(type:String, val:Number):void {
super.(type, val);
this.val = val;
}
public override function clone():Event{
return new CustomEvent(type, val);
}
public override function toString():String{
return formatToString("CustomEvent", "type", "val", "bubbles", "cancelable","eventPhase");
}
}
}
And when I call the events it is done like this:


Code:
package dk.classes.xml {

import flash.display.Sprite;
import flash.events.Event;
import flash.events.EventDispatcher;
import dk.classes.events.*;
.
.
.
.
..
addEventListener(CustomEvent.DONE, returnLoad);
dispatchEvent(new CustomEvent(CustomEvent.DONE, 10));
I have absolutely no idea where to start

All Adobe has to say is :


Quote:




1203No default constructor found in base class _.

You must explicitly call the constructor of the base class with a super() statement if it has 1 or more required arguments.




Thanks for any help given

View Replies !    View Related
I Need To Import Only Needed Classes Into My Mother Class
If anyone has any idea how to perform a dynamic #include workaround or dynamic import. What i have is a class that needs the code from other classes to perform some operations and what I want is to be able to import only the classes i need based on a parameter. Thanks in advance if some replyes to this

View Replies !    View Related
Tween Class Import In Flash 6.0 MX 2002
I have a very old version of flash, flash 6.0 MX 2002, and am still learning. I was trying to use the tween class, and received the following error.

Scene=Scene 1, Layer=text, Frame=10: Line 1: ';' expected
import mx.transitions.Tween;

Scene=Scene 1, Layer=text, Frame=10: Line 2: ';' expected
import mx.transitions.easing.*;

Here is the code that I am trying to implement:
--------------------------------------------------------------
import mx.transitions.Tween;
import mx.transitions.easing.*;

on(rollOver){
trace(this._x);
this._x = 138.45;
}

on(rollOut) {
this._x = 158.45;
}

on(release){
_level0.parda.attachMovie( "unitedwords_graphics", "unitedwords_graphics1", 1);
_level0.parda._height= 300;
_level0.parda._width=400;
var xScaleT:Tween = new Tween(this, "_rotation", Elastic.easeOut, 0, 360, 3, true);
}

Right now I'm just trying to make any kind of tween work here, after which I can play around to select the correct effect. This code is on a movieclip.

I'm suspecting that maybe I can't use these tween class imports, sinceI'm using such an old version. But I'm posting here to get a more expert opinion. Your help would be much valued.

Thanks.

View Replies !    View Related
Import Tween Class Once Or Multiple Times?
Hello everyone. I am using the tween class on my first key frame of my mc. It looks like this;


Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var myTween:Tween = new Tween(main_mc, "_x", mx.transitions.easing.Elastic.easeOut,590, 0, 3, true);
However my question is if I have multiple mcs that will use the same code how do i reference it? Currently I have the above code duplicated on two key frames, one of the first and another after a stop keyframe.

I am thinking I should put this in a global function or maybe some other way but not sure how. Any help is appreciated.

View Replies !    View Related
Class Problem Import Through Linkage Properties
hello,

I want to Linkage one MC in my library. So I wrote
In Class zPlayerClasses.contoller,
In Base class flash.display.MovieClip

My class contoller is located in folder zPlayerClasses, and it is in the main directory (with .swf).

this is my class script:

ActionScript Code:
package zPlayerClasses{    public class contoller extends flash.display.MovieClip {       public function contoller():void {          trace("contoller class instance");       }    } }


After compile output this error, why?

1017: The definition of base class MovieClip was not found.
5000: The class 'zPlayerClasses.contoller' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.

The some error come after change flash.display.MovieClip to MovieClip

View Replies !    View Related
My RecordSet Class Won't Import Fl.data.DataProvider
Why won't the DataProvider base class import!?

I keep getting an error with this class.

PHP Code:



package com.gfxcomplex.data {        import fl.data.DataProvider;            class RecordSet extends DataProvider{                public var dataProvider:DataProvider;                    public function RecordSet(values:Array, category:Array){            var ar:Array = new Array();            for (var a:Number = 0; a < values.length; a++) {                ar[a] = new Object();                for (var aIndex:* in category) {                    ar[a][category[aIndex]] = values[a][aIndex];                }            }            dataProvider = new DataProvider(ar);        }    }} 





Quote:




class RecordSet extends DataProvider{
1017: The definition of base class DataProvider was not found.

View Replies !    View Related
Understanding The Need For Package/class Import -beginner
Hi all,
first time here. -really glad I found the site, it looks like a wealth of useful information.
OK, here goes: I'm very new to Flash, still learning. I started learning AS2, but I figured it would be less confusing if I tried to focus on AS3 as future versions will be based on this.
I'm a little confused about the need to import packages and classes. I'm starting to understand the concept, but let me give you a for-instance:

Here's some AS3 that will load a PDF file when a button is pressed (code from the Adobe Help files):

function loadPDF(event:MouseEvent):void
{
var resumeURL:URLRequest = new URLRequest("MBeckman_Resume.pdf");
navigateToURL(resumeURL);
}

button_mc.addEventListener(MouseEvent.CLICK, loadPDF);


-works great. The question is: if this works fine as-is, what is the need to follow the "creating and importing of packages/classes and such"...method of coding?

thanks for any help in understanding these fundamentals. I'm trying to wrap my head around OOP, and I can see it will be a long journey.
-mike

View Replies !    View Related
Import A Class: Cursor Turns From Arrow To Text
Hi all,

I import a class (ToolTip) into mainframe. It works well, but when I move the cursor to the left-top corner, I see it turns to text cursor (like |). Anyone know why and how to fix it?

Thanks,
tuyle


Code:
import ToolTipClass
var toolTip= new ToolTipClass(_level0);

hitTest_mc.onRollOver = function() {
toolTip.setText("This is tooltip");
}
hitTest_mc.onRollOut = function() {
toolTip.clearText();
}

View Replies !    View Related
Actionscript2 - Import Class Camera, NetStream, Video.
Im deployng an application in actionscript2...

Im using Flash 8 from a preview installation of Flash MX and with import of
control class there are no problems (C:ProgramsMacromediaFlash 8enFirst
RunClassesmxcontrols)...

Classes NetStream.as, Camera.as e Video.as are on this location
(C:ProgramsMacromediaFlash 8enFirst RunClassesFP8).... How can i
import those????

I do this:

import FP8.*; or

import FP8.Camera;
import FP8.NetStream;
import FP8.Video;

NOTHING..... Its impossible to charge this classes.....

Maybe thos .as are olds??? or im doing something wrong with import path????

Thanks
Rob

View Replies !    View Related
Bulk Import Statments Vs. Specific Import Statements...any Performance Difference?
Lets say I have 20 classes located at nl/amsterdam/simulation/model/. Now I'm writing another class that is going to use some of those 20 classes. Is there any performance difference in the compiled swf if I import them all using a wildcard:

Code:
package nl.amsterdam.simulation.view
{
import nl.amsterdam.simulation.*
...
versus importing each specific one that I need?:


Code:
package nl.amsterdam.simulation.view
{
import nl.amsterdam.simulation.model.Tulip;
import nl.amsterdam.simulation.model.Canal;
import nl.amsterdam.simulation.model.Prostitute;
import nl.amsterdam.simulation.model.StonedTourist;
import nl.amsterdam.simulation.model.BuisnessMan;
import nl.amsterdam.simulation.model.Windmill;
import nl.amsterdam.simulation.model.CoffeeShop;
import nl.amsterdam.simulation.model.SkinnyBuilding;
...
Or is there only a difference in the time it takes to compile, not the time it takes to execute?

View Replies !    View Related
When Is Necessary To Use Import Statements To Import Classes?
Hi,

I'm sure that it must be necessary to use import statements in some situations, I'm finding that my code often works fine without them. For example, some instructions will say it is necessary to use import.flash.events.MouseEvent; before MouseEvent.CLICK will work, or that I must import the loader class before loading an SWF, but I'm finding that I can skip timporting and it works fine. Could anyone please explain why this it, and give me some idea of how to knew when to import and when I don't have to?

Thank you in advance!

View Replies !    View Related
Can't Import Import Fl.controls.ComboBox
Hi all!

I am starting learning AS 3.0 (used to use AS 2, that was sweet times ) and actually can't understand simple thing - why I can't include that package from action script?

I actually start new Action Script 3 file, and put single line in first frame


Code:
import fl.controls.ComboBox
and got errors

Code:
1172: Definition fl.controls:ComboBox could not be found.
1172: Definition fl.controls:ComboBox could not be found.
Actually thats part from the code listed at the manual and I don't have any idea, why it doesn't work.

Also when I open components window and drag combobox to scene error is not showed any more.

Any ideas how can I solve this problem without adding combobox to the library?

View Replies !    View Related
[Flash 8] Import, Import, Import
Last edited by Nutrox : 2005-09-18 at 06:24.
























&nbsp;
Ahh!! I'm already getting a bit tired of having to continuously import classes into Flash for things like BitmapData, Rectangle, and Point etc. Is there a way I can set things up so that these classes don't need to be manually imported all of the time?

I've tried a few things including : (a) Creating extension classes, but Flash moans about class paths when I try to import something like flash.display.BitmapData into my own class. (b) Setting a class path so that it points at the class directory .. $(LocalData)/Classes/FP8/flash/display/ .. but that doesn't work either (I know why, but it was worth a shot). (c) Importing the entire class package .. import FP8.* .. but that causes errors with a tonne of other classes. import FP8.geom.* etc works though, but that doesn't really help.

Am I just missing something obvious here, or is there no way around this?


Si ++

View Replies !    View Related
Import Via "import To Stage"
I opened a new AS2 document in Flash CS3

I designed a clip which I saved as an fla and exported to an swf file.

Now I imported the swf onto the stage but all that has happened is that the seperate swf componens are on the stage and not the complete clip?

View Replies !    View Related
Calling A Function In Main Class From A Loaded Swfs Document Class
Hi
I have a main.swf that loads page.swf. They each have a document class called "Main" and "Page".

How can I call a function in Main from Page?

In AS2 this would be somthing like _parent.myFunction();


Cheers

View Replies !    View Related
Class Question: How To Access Timeline Objects From Class W/o Arguments
Hey all,

I am looking into builiding an application with OO functionality. I understand most of it. Except I cannot figure out how to access something in my app from a class. For instance, lets say I have one Loader class that loads some data and stores it in a variable inside the class (or on the main timeline, doesn't matter). Now, I know I can pass a reference to the data in an argument to another class for that class to manipulate. But if I have several data sources, and other variables and such, that I need to modify in a single class function, how would I do that without having to give the function access to them through arguments? I just want to be able to say, from a class, something like _root.someObject.someFunction();

So, any help would be greatly appreciated, and sorry if that made no sense at all, I tried to explain as best I could.

Happy Holidays!
Dave

View Replies !    View Related
[Flash 8] Referencing Class Variables From OnEnterFrame Created Within Class
Hi,
It's been a while since my last post here, but I was hoping someone could help me with a problem I'm having. I want to reference and change a class variable from within an onEnterframe function defined within a class. I can actually do this right now, but I want to do it in a different way. Here's a code sample of what I am talking about:


Test.fla file:

Code:
var t:tester = new tester()

Working tester.as file:


Code:
class tester{
private var num:Number = 100;

function tester(){
var classObj:tester = this;
var mc:MovieClip = _root.createEmptyMovieClip("test",1);
mc.onEnterFrame = function(){
trace(classObj.num); //This traces 100 (CORRECT!!!)
}
}
}
This traces 100 to the output window, just like it should

Here is the way that I would like to do it, because I want to reuse my onEnterFrame Stuff:

Code:
class tester{
private var num:Number = 100;

function tester(){
var classObj:tester = this;
var mc:MovieClip = _root.createEmptyMovieClip("test",1);
mc.onEnterFrame = this.mcOnEnterFrame;
}

private function mcOnEnterFrame(){
trace(num) //this traces undefined (BAD!!!)
}
}

As you can see, the work around to reading the class variable in the onEnterFrame function is to create a reference to the class object, before defining that function, then using the reference you created to access the class variables.

I have tried various iterations to get the second example working, but have had no luck. Does anyone know a way to get the second method working, or am I stuck using the first method.

View Replies !    View Related
AS3 Project In FDT + Flex SDK. Root Class Extends Visual Class From Swc
hello
question about compiling as3 project under FDT 3.0 with Flex SDK.

I want my main root class to contain some graphics already at the start. In Flash IDE I put some objects on the stage, make new symbol with all those objects inside, set linkage to MainClassGraphics, export it to swc, add this swc to source folder class-path. Then I write my root class:

Code:
package {

public class MainClass extends MainClassGraphics {
public function MainClass() {
trace('hey');
}
}
}

compiling with flex2 sdk - and I don't see any graphics. why?

if i try this way:

Code:
package {
import flash.display.Sprite;

public class MainClass extends Sprite {
public function MainClass() {
var s:Sprite = new MainClassGraphics();
addChild(s);
trace('hey');
}
}
}

then I see my graphics.. so swc looks like fine


crosspost here http://fdt.powerflasher.com/forum/vi...hp?f=21&t=2268

View Replies !    View Related
Accessing A Dynamic Text Field In A Class Other Than The Primary Class
I have tried to read and understand some of the other threads for this issue but, I think it would be easier to understand if I show my specific issue. I left some code out to make my issue more clear.

Alpha is the primary class with access to the stage. If I write the event listener and function contained in the Bravo function into the Alpha function it works. Although, I want it to be in a different class in the same package (such as the Bravo class).

I have created a instance of a class which is a physical object on the stage (lets say it's a card). The event listener is in the instance so that each instance has a self contained listener.

The bottom line is it works in the primary class but in no others. How can I make it access the text field (so when I click on the "card" the text field shows "something"?


ActionScript Code:
package a {
     public class Alpha {
          public function Alpha() {
               x:Bravo = new Bravo();
          }
     }
}

package a {
     public class Bravo {
          public function Bravo() {
               this.addEventListener(MouseEvent:CLICK, clickEvt);

               function clickEvt(event:MouseEvent) {
                    <MovieClip>.<MovieClip>.<DynamicTextField>.text = "something";
               }
          }
     }
}

View Replies !    View Related
Calling SetTimeout Within Custom Class And Cannot Access The Class' Variables
Hi All,

I'm creating an user interface with Flash 8, I'm new to Flash, my background is Java therefore I decided to use ActionScript to create a custom component that is reference within an external file.

My problem I believe is scope related. I have a status bar (label component), once I update the status bar I want to call the
"setTimeout" function to wait a couple of seconds before clearing my status bar. The "setTimeout" function is executing, but for some reason my status bar is not being cleared (accessed).

Below is a snippet of my code. Any help appreciated. Thanks.


/*
External File
*/
import mx.controls.Button;
import mx.controls.Label;

class MyApp
{
//private properties
private var mc_container:MovieClip;
private var btn:Button;
private var lbl_status:Label;
private var str:String = "do see me";

//constructor
public function MyApp(target:MovieClip)
{
trace("-- MyApp --");
mc_container = target.createEmptyMovieClip("mc_container", 100);
}
//public methods
public function init(width:Number, height: Number, xPos:Number, yPos:Number):Void
{
var my_app:MyApp = this;

btn = mc_container.createClassObject(Button, "btn", 1, {label:"click me"});
btn.setSize(100, 25);
btn.move(10, 10);
btn.clickHandler = function():Void
{
trace("btn clicked");
setTimeout(my_app.clearStatus, 2400);
//correct if I call directly
//my_app.clearStatus();
trace(str);
}

lbl_status = mc_container.createClassObject(Label, "lbl_status", 2, {text:"status bar message"});
lbl_status.setSize(200, 25);
lbl_status.move(0, 50);
}
public function clearStatus():Void
{
trace("calling clearStatus");
lbl_status.text = "";
}
}


/*
Called for Flash IDE
*/
var app:MyApp = new MyApp(this);
app.init(200, 200, 0, 0);

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved