ActionScript 3.0 :: Astro 3D - How To Assign Z Dimension To Sprite Object
May 13, 2009
I am really confused with this tutorial as there is shown how to assign z dimension to the Sprite object. It is never declared, so I assume the z property should be implemented to the Sprite class. But obviously I get an error when I try to build the application does not matter if it is flash or flex app. From my point of knowledge I can not find z property for Sprite in the actionscript, so I do not know how Lee implemented his code to work. Below I put all the code from the tutorial, so you can quickly glimpse at it. How is it possible to assign z dimension to work it, or suggest what kind of class to import or whatever I should do, or know anything about the z dimension in flash player 10.I do not really think z could be in 10-beta and is not in 10 official.
I have a brick class where I have created a rectangle using flash.display.graphics.I am using this brick class to create a grid of 10 X 10 in another class called grid using new brick() in a for loop.I have another class called ball where I have created a circle with flash.display.graphics.The problem is that I want to remove / destroy individual bricks when the ball hits the bricks on Event.ENTER_FRAME which is not happening.the error I get is shown only for the last brick that is created in a for loop.ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild() at grid/ball_movement()// my function in enter frame event The code I wrote in ENTER_FRAME is
I have a brick class where I have created a rectangle using flash.display.graphics.I am using this brick class to create a grid of 10 X 10 in another class called grid using new brick() in a for loop.I have another class called ball where I have created a circle with flash.display.graphics.The problem is that I want to remove / destroy individual bricks when the ball hits the bricks on Event.ENTER_FRAME which is not happening.the error I get is shown only for the last brick that is created in a for loop.[code]
The issue I'm having is that I have a main "wrapper" 100x100 (but it could be any size) - it's just there to hold and display whatever content, swf, gif, etc we may want to throw into it. As long as the loaded content doesn't have 3D animation like rotationY going on, it displays fine. But when it does, the 3D "anchor" properties (like projectionCenter) of the loaded swf inherit those of the main timeline (i.e. 100x100 (main) vs 728x90 (loaded)). If I change the dimension of the main "wrapper" in Flash IDE to match what's coming in - the 3D behaves fine, but I won't know what the dimensions of the content will be until it comes, so I need a way (if there is one) to dynamically alter the main "wrapper" or root display object through AS. Stuff like "this.width = loader.width" or "stage.width = loader.width" or "root.width = loader.width" etc doesn't work. Flex has the hBox and vBox
I have a class (ImageLoader) that extends Sprite container and loads an external image to its instance. When i instantiate an object of this class from another (Main) class i want to have the dimensions (width, height) of the loaded image being known to this (Main) class. It seems that is difficult for me as the dimensions are known after the image compete loaded. But i don't know how to pass this information from completeHandler event handler to the Main class.
Is it possible to automatically assign an object to a class during testing project? I know you can do so by assigning in a movie clip's property the identifier but I need to know if I'm say creating a game, and it gives the user the ability to choose a player, I need that player/movie clip that the user chose to be assigned to a specific actionscript class.
I have an object on stage that when I want to click it start to move cross the stage. But I get error:"Scene 1, Layer 'Layer 1', Frame 1, Line 41136: Incorrect number of arguments. Expected 1."
How do you assign an object different variables.I tried setting it up like this but I get an error.[code]How do you do this correctly I get error Label must be simple identifier when I do it like this.
trying to find how to assign listener to an object created with this function...
Code: private function placeBtn(thumb:String, Xthumb:Number, Ythumb:Number, targetHolder:MovieClip, ID:String):void{ var clipHolder:MovieClip = new MovieClip();
i want to assign a transform matrix to an object, but i want to assign the values myself (as in, no 'rotate, scale etc'), but for example, set a matrix like
[Code]...
which if applied, would have no effect, but would be valid (actually not exactly that matrix, but you get the idea). i want to set the values of the matrix and the object should be affected by those values that i set by myself, no scale rotate or any predefined operations. how can i set my own matrix?
How you can assign a class to an object on stage.[code]...
This would make a new object, but the current object already exists, it just needs to be notified that it's of the type "ClassName" so it can inherit it's properties.I've also tried assigning the "ClassName" in the linkage as either the base path or the class name. But in either situations I get an error saying that the class needs to be unique when I use the same class on multiple objects.
I am trying to use JSON decoded as a dataProvider, but no matter what I try I get errors such as the following: Error #1034: Type Coercion failed: cannot convert mx.collections::ArrayCollection@2a88ae01 to fl.data.DataProvider.
I'll try to make this as clear as possible. Let's say i have 4 "classes".
[Code]...
Let's say now i use a loop to create 8 obj. I'd like to assign a class to each obj in function of an array like : array = [class1, class2, class1, class3, class2, class4... ] so obj0 class' should be array[0]
I want to load two picture and add every picture to every sprite object,such as picture a to sprite1 and picture b to spriteb,I know I can load a pictue by following code:
loadImage('a');loadImage('b');private function loadImage(imagePath:String):void { var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoaded); loader.load(new URLRequest(imagePath));}private function
What I'm about to ask might be completely nonsense/basic or something else. Because my AS knowledge is too little. Hope I can explain correctly. I am tring to create a sliding banner animation dynamically. The reason that I create dynamic is that I want to load banner images and headlines from XML file.
What I'm about to ask might be completely nonsense/basic or something else. Because my AS knowledge is too little. Hope I can explain correctly
I am tring to create a sliding banner animation dynamically. The reason that I create dynamic is that I want to load banner images and headlines from XML file.
So I found a sample project with .as and .xml file. It does what I want but it has no animation. You can see the demo here: [URL] As you can see, there's a transparent info panel below. Here's the code how it is being created:
private var infoPanel:Sprite = new Sprite(); private var titleField:TextField = new TextField(); private var description:TextField = new TextField();
I want to load two picture and add every picture to every sprite object,such as picture a to sprite1 and picture b to spriteb,I know I can load a pictue by following [code]...
I'm making a resize function that has to resize a Project object that extends Sprite.
But I keep ketting a type coercion error: TypeError: Error #1034: Type Coercion failed: cannot convert AS:: Project@318ff89 to mx.core.IUIComponent.
I've tried casting the Project object to an UIComponent or DisplayObject, but this also throws a TypeError.
[AS]var resizeTarget:UIComponent = new UIComponent(); resizeTarget = UIComponent(target.getChildAt(0)); var myResize:Resize = new Resize(resizeTarget);[/AS]
So basically should I try avoiding the use of Sprites in Flex?
I'm trying to learn shared objects by attempting a basic function. I would like to have an .sol file remeber what buttons are clicked on by a user and assign an alphavalue for the buttons that have been clicked. Here's what I have..
I have created instance of textField Object and set property scaleX and Y in large and then I my textfield set into Sprite Object. I saw my text in ugly font . How can I have my text in smooth .
I have two sprite object and they direct to same event like follows: sprite1.addEventListener(MouseEvent.CLICK, mouseEventHandler); sprite2.addEventListener(MouseEvent.CLICK, mouseEventHandler); private function mouseEventHandler(event:MouseEvent):void { //how to do it here? } When click spirt1 or sprite2,it will call mouseEventHandler function,my question is how to determine which sprite is click in mouseEventHandler function,sprite1 or sprite?
I'm trying to debug AS3 code on production. I have no access to trace(), can't write to disk or open a socket. What I want is to display something on screen.
With AS2 I could just access _root and create a text field with my trace data.
how I can pull this off with AS3? My class extends Object, it is not a sprite and is never added to a parent display object.
I'm rendering a xps file using flash (no MX or Spark), and I'm running into a sort of 'contradiction' that I'm unable to solve. [Note, that I'm trying to work only in core flash (e.g. Sprite, Shape, etc.), I've already solved (sort of) this issue using Spark.]
The pages of the xps file specify an explicit size. However, the content described (especially paths) in the xps file can sometimes extend outside of this area.
The problem is, I want the parent Sprite to have the size specified by the xps file, for example so scroll bars match the page size (not the sprite size), but in some cases the Sprite is much larger than this.
I've tried recursively going down and scaling everything UP, and then at the end scaling the parent container DOWN. Unfortunately, this causes translation problems with paths, and I assume it can also cause problems with bitmaps, etc.
Without using MX or Spark, is there anything I can do to control the size of the parent Sprite, other than scaling all the children independently?