ActionScript 3.0 :: Mix Normal Sprite With Context3D Object?
Dec 15, 2011Just querying if is it possible to mix normal sprite with Context3D object.
View 8 RepliesJust querying if is it possible to mix normal sprite with Context3D object.
View 8 RepliesI 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
[code].....
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]
View 1 Repliespoint to documentation on how to use this in respect to loading a Material with Ka Kd Ks Ns and Tr as OBJ material.
View 4 RepliesIf I make multiple draw calls for various Program3D instances, is there a way that I can reset or nullify the constants if I'm no longer using them in the next following Program3D assignment?
Is it even necessary that I do something like this?
//Nullify 'vc0' in the vertex shader:
context3D.setProgramConstantsFromVector("vertex", 0, null);
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
[code].....
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.
[Code]...
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();
[Code].....
Does anyone know a way of duplicating a Sprite object.
View 9 RepliesI 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]...
View 2 RepliesI'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 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 .
View 1 RepliesI 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?
I am new to Flash and ActionScript 3.0 environment. I have only basical knowledge regarding this platform.
My issue/problem starts here:
I have a Sprite object on the stage.
What I should do in order to change the dimensions (viz.,size,colour, or both ,etc) of this Sprite object, when it gets clicked?[code]...
I load a picture file by Loader and add Bitmap into sprite,like follows:sprite1.addChild(myBitmap);Now I want to get the myBitmap from sprite1,how can I get myBitmap from sprite1,what code can I use?
View 1 RepliesAnyone can teach me how to convert an array to object or to a sprite.
View 2 RepliesI have a Sprite object on the stage. What I should do in order to change the dimensions (viz.,size,colour, or both ,etc) of this Sprite object, when it gets clicked?My sample code looks like this:
Code:
var circle:Sprite = new Sprite();
stage.addEventListener(MouseEvent.CLICK,onStage);
function onStage(e:MouseEvent):void
{
[code]....
I am trying to get an image object from one sprite container and adding it to another sprite container. But when I use GetChildAt for this, it will remove the object from the parent sprite and place it inside the other.
Code: sprContainer1.addChildAt(sprContainer2.getChildAt( 1),0);
Problem is when I run this code sprContainer2.numChildren is getting reduced by 1, which seems that this code removes a child from sprcontainer2.
Is there a way to check if an event object is == to a sprite. For example
Actionscript Code:
if(evt.target == [object Sprite])
I got this error upon trying to remove the child object from a sprite using a timer.
function notify(e:Event){
var bx = new box();
con.addChild(bx);
[Code]....
I've got a few spites on stage that are created dynamically and live in an array. I'm rotating images through these sprites and now need to know which image is in a sprite when clicked. My code: loading the images:
[Code]...
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.
Code:
Select allpackage {
import com.caurina.transitions.*;
import flash.display.Sprite;
import flash.events.*;
[SWF(width="600", height="400", backgroundColor="#FFFFFF", framerate="30")]
public class ThreeD extends Sprite{
[Code] .....
Here, my loader instance name is: myLoader. When I click on the dynamically loaded image, I need to place a small red rectangle at that particular pixel position on the image.For creating a small rectangle, I am using following code:
[Code]...
I'm making a game where I have must have some objects like weapons and characters, which I in the end would like to get visual as a sprite or movieclip
Should I write the logic for the objects in several classes and then make a reference to the object in a sprite class like the following :
[Code]...
And then when I need to do damage just call the WeaponSprite's method weaponModel() when I need to acces the methods or should I just merge the two together into one class.?
When you load a object through flash, you can set the rotational/scale point, but when you load it as a loader object or sprite, how do you change this point?
In this instance, I want to change the height of a sprite that is filled with a rectangle so that it shrinks down, not up.
Right now:
var colored_bar:Sprite = new Sprite();
with (colored_bar.graphics) {
beginFill(0x9e1819, 1);
[Code]....
The way I am doing it currently is moving the y position everytime I take away soem of the height, so it looks like it's moving down, but I'd think moving the orientation point at the beginning would be faster
I'm trying to make a little program. It works right now by drawing the top shape to the dark gray area, where it then copies itself and changes color. The new shape can be re-dragged as well. What I want to do now is add a dynamic border when I click on the new object, I want the box to adjust to an appropriate size. And on mouse release I want the selection border to disappear on the new shape. I want the selection border to be dashed much like you find in many of Adobe's programs, if at all possible.
Attached is my .fla file
Ages since I last played with away3d, totally forgot how to use it.What do I do if i want to add a Sprite or object capable of adding Sprites to my Scene3D?
Edit: Using the MovieMaterial in not a possibility due to YouTube disabling Draw() on their APi
When I'm disposing a sprite which has drawings on its graphics object, Do I need to use "graphics.clear()" or is "mySprite = null" is enough?
View 3 Replies