ActionScript 3.0 :: Flash Display Package Sprite Class?
Nov 24, 2011Where does Sprite class under flash display package located?I find only flash display 'BitmapData' under AdobeAdobe Flash CS3enFirst RunClassesFP9flashdisplay
View 3 RepliesWhere does Sprite class under flash display package located?I find only flash display 'BitmapData' under AdobeAdobe Flash CS3enFirst RunClassesFP9flashdisplay
View 3 RepliesI want to create a basic drawing utility as a part of my project. Since the drawing needs to be saved I wanted to convert it to a bitmap. I searched for help on google and found this example.
However since the rest of my program is programmed in AS2, I'm getting errors these errors:
Quote:
The class or interface 'flash.display.Sprite' could not be loaded. // source: var canvas:Sprite = new Image();
The class or interface 'flash.utils.ByteArray' could not be loaded. // source: var bytes:ByteArray;
The class or interface 'flash.display.Shape' could not be loaded. // source: var child:Shape = new Shape();
[code]...
Say i have these two classes:
MAIN.as
package
{
import flash.display.*; import mx.core.*;
import flash.events.*; import mx.collections.*;
[Code]...
Now how is it that I can add the variable SPRITE which is a Sprite in the OBJECT_square class to the display list of MAIN class? I've tried addChild(SPRITE) and super.addChild(SPRITE). If everything works I should see a red square somewhere on the screen but right now its all blank, except for the text drawn in the MAIN class.
Basically I want it so i can just make a new OBJECT_square and it will draw itself without any more instructions from the MAIN class.
I have classes witch resides in this package :com.network.interface_as. When I try to load one class from that package in another class in the same package like this:
[Code]...
So basically i have my root folder with my fla and my document class in it, then I have a folder called 'main' with another class in it (Control)
But I can't seem to import my main.Control into my document class... (I would like to create an instance)
Code:
package{
import flash.display.*
import main.Control//is this wrong?
[Code]....
When I export assests for actionscript the defaul package is empty it there change to change it? To each time I export library asset for actionscritp default value for class field will contain package?
ex.
Class: assets.MyClass
I created a class, extended the sprite class, and now in the constructor I am trying to set the Sprite's width and height properties which are inherited from the DisplayObject. However, after I set this.width and this.height, and print the values, I get 0 for both.
What the heck is going on? When I view the livedocs I see that DisplayObject has width and height listed as public properties. I have been able to instantiate a Sprite directly, and set the width and height after it's been instantiated, so I don't get it.
package {
import flash.display.*;
public class ScrollBar extends Sprite {[code].....
cannot convert flash.display::Sprite@39394a9 to flash.display.MovieClip.here is sample code
var enemyArray:Array = new Array();
var mySprite:Sprite;
mySprite = new Sprite();
[code].....
cannot convert flash.display::Sprite@39394a9 to flash.display.MovieClip.
here is sample code
Code:
var enemyArray:Array = new Array();
var mySprite:Sprite;
mySprite = new Sprite();
[Code].....
then it will be ok, but my goal is, How can enemy call the removeEnemy() in parent while it is inside the sprite
I am using Flash CS5 and am getting a very odd error when I compile. All my classes are in the package com.es3.as2. In the first frame of my movie, I have the following code:
import com.es3.as2.Shell;
I have my classpath set correctly. When I compile, I get this error:
, Line 1 There is no class or package
with the name 'com.es3.ProgressBar'
found in package 'com.es3'.
This is odd because nowhere do I refer to a "com.es3" package. It's always "com.es3.as2".If I remove the import line, the movie compiles with no errors (but without the initialization code, it doesn't run correctly).
[Code]...
Is there an easy way to reset all of my variables to the way they were when I first loaded the package so that I don't have to go through all of the variables and reset them manually?
I want to override the dispatchEvent method while inheriting from flash.display.Sprite. Whenever an event gets dispatched now like ADDED_TO_STAGE and CLICK it will get through dispatchEvent in my theory. However there is no single trace he'll get through dispatchEvent.. so the events get dispatched internally from some where else?
[Code]...
I am learner of AS3 and xml. So I have referred everywhere and copied the code. I am getting:
"Error #1069: Property data not found on flash.display.Sprite and there is no default value.
at flashhaupt01_fla::GalleryData01_1/imagepress()" error in as3.
I am trying to get the url from xml into as3, but not getting how to do it. Here is my code
var xmlReq:URLRequest = new URLRequest("XML/ImagesData01.xml"); // rename to your file!!!
var xmlLoader:URLLoader = new URLLoader();
//xmlLoader.addEventListener(Event.COMPLETE, xmlLoader); // event listener b4 load!!!
xmlLoader.load(xmlReq);
var myXML:XML;
var headLoader:Loader;
function imagepress(e:MouseEvent):void {
[Code] .....
It seems I have no trouble pointing an FLA's document class to my project's class package when the FLA is at the same root level as the package's top-level directory. However, if the FLA is nested in a sub-directory, then relative paths to a class nested in the package will not work.example package & class location : [url]....
Case1 :
Package location : MyProject
FLA location : MyProject[code]........
If someone can provide an explanation as to why nested FLAs can't point to custom packages in parent-level directories, OR demonstrate how this can be done,
I try to load classes ex:flash display.Sprite(); and I get error messages. Not just with this code with any class I try to implement. why this is happening. Am I missing the folder that has all of the classes in them in Flash CS3.
View 3 RepliesI'm attempting to read a property on a series of Sprites. This property may or may not be present on these objects, and may not even be declared, worse than being null.
[Code]...
"Error #1069: Property data not found on flash.display.Sprite and there is no default value.at flashhaupt01_fla::GalleryData01_1/imagepress()" error in as3.I am trying to get the url from xml into as3, but not getting how to do itI need to demo this within 1 hourhere is my code
var xmlReq:URLRequest = new URLRequest("XML/ImagesData01.xml"); // rename to your file!!!
var xmlLoader:URLLoader = new URLLoader();
//xmlLoader.addEventListener(Event.COMPLETE, xmlLoader); // event listener b4 load!!!
[code].....
Using Flash CS5 Professional I have created a symbol, dragged it onto the stage, and given it an instance name of GreenLight1. If I want to make this visible from the document class, I can simply do the GreenLight1.visible=true; and poof it's good to go when I test the file. As long as I stay in the document class I am good to go, but now I'm trying to move to another class and hitting ALL kinds of trouble just trying to get Flash to allow me to access this simple object. All I am looking to do is have this GreenLight1 go invisible (visible=false) when a certain condition occurs in this new class and Flash just won't let me access GreenLight1 at all. Things I've tried thus far:
stage is passed to the class and is referenced by _stage and is working just fine when I do _stage.addchild or anything like that. So I have tried "_stage.GreenLight1.visible=false;" and I get "ReferenceError: Error #1069: Property GreenLight1 not found on flash.display.Stage and there is no default value." My document class extends Sprite, so I figured I'd try the root function. So I tried "Sprite(root).GreenLight1.visible=false;" and I get "1119: Access of possibly undefined property GreenLight1 through a reference with static type flash.display:Sprite." I tried to create the Resource class as described therein. To which I came across the same problem that I started with in that it doesn't know what GreenLight1 is to begin with so I got "1120: Access of undefined property GreenLight1." Here is my code for Resource.as (am I supposed to pass something to this class from the document class?)
[Code]...
And i cant figure it out.the "my.fla.class"content looks like this
Code:
package my_fla
{
[code].....
package {
public class priyan {
public var a:String = "priyan";
public var b:String = "bhagavath";
public function method():void {
trace(a);
trace(b);
The above script, i got it from one of the ActionScript 3.0 book. i just work it out in flash. But it shown error 5000: The class 'priyan' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
[Code]...
I have defined some sprites in a class .as file and I want to put them in the screen. How can I do this?
View 2 RepliesI'm trying to build a shuffle function that somebody gave me into my card game. I two external .as classes; one is Shuffle.as, which is my document class, and the other is card.as. I'm building the shuffling function into Shuffle.as. I think I'm getting close to making it work, but there are some problems. I keep getting this error message: "5000: The class 'Shuffle' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type." Here is my code. Shuffle.as code
[Code]....
i have a BasicMap.as that takes an Array and populates itself with the MC objects passed to it by a String reference.it inherits from Sprite, and so it just places the objects on its self.then i have a class that inherits from that class, and gives a little more functionality to it, but in order for it to do that, it needs to place the objects not on itself, but instead inside a holder Sprite, so here is my problem:
code:
package Mushroom{
import flash.display.Sprite;
[code]......
In AS3 I turn a sprite(spButton) visible property to false initially.AT some point I turn on the image property so it is visible but nothing is displayed when i do?It works fine if I dont make the image invisible on load.
private function imageLoaded(event:Event):void { var image:Bitmap = new Bitmap(event.target.content.bitmapData); spButton.addChild(image); spButton.x = 240; spButton.y = 350; IntroCanvas.addChild(spButton); spButton.addEventListener(MouseEvent.CLICK
[code]...
I wanted to design a [relatively] all purpose class to load images and SWF's with a preloader MC and error handler. I made this BUT, when I load the MC I cannot control it. i.e. I load an SWF containing an animated GIF, but I cannot say mc.gotoAndStop();
[Code]...
I wrote a class that performs an asynchronous loop. It needs a package name. I already have a util package, but feel resistant to put half of my classes in that package. If it really belongs there, I'll put it there, but I'd feel much better if I can find a more appropriate/specific package.
View 3 RepliesI'm having a bit of trouble getting a class to import.[code]...
View 1 RepliesI have classes witch resides in this package :com.network.interface_as. When I try to load one class from that package in another class in the same package like this:
Code:
import com.network.interface_as.SomeClass_A
class com.network.interface_as.SomeClass_B{
private var class_A:SomeClass_A;
public function(){
class_A = new SomeClass_A();
}}
I get error message that "class com.network.interface_as.SomeClass_A could not be loaded".
I'm sure you're expecting me to have forgotten to use addChild. I wish it was that easy. I will say I'm very new to AS3.0. I have a movie clip in my library that contains a small PNG file and a text label. The linkage properties are: Class: shapes.HorizontalIcon, Base class: flash.display.Sprite.[code]As far as I can tell this should work. There are no errors. The trace statement above shows up in the output. The parent sprite is also an item from the library. It shows up on the stage. I tried adding a random TextField to the parent sprite it showed up on the stage just fine.Something isn't working right, but I don't know where to start debugging this.
View 7 RepliesI need to assign dynamically a path to a xml file through Flashvars. How I can make it work?
I was able to get Flashvar from html page into swf with actionscript code on timeline[code]...