ActionScript 3.0 :: Add The Clip Under The First Sprite?
Feb 4, 2010i have the cahcefile defined and how to add the clip under the first sprite?
ActionScript Code:
function loadData()
{
trace("files found "+filesF);
[Code]....
i have the cahcefile defined and how to add the clip under the first sprite?
ActionScript Code:
function loadData()
{
trace("files found "+filesF);
[Code]....
Is there a way to set a clip area for a movie clip or sprite so that it will not draw out of that particular area? I am using a drop shadow, and it doesn't look right if the shadow passes a certain boundary, so I wanted to find a way to force it not to draw out of a particular area.
View 1 RepliesI'm working on a pathfinding algorithim using A* and using irregular polygon shapes as obstacles rather than a grid. I don't fancy plugging in all the points and links by hand and was wondering if there was some way I could just get them from a Sprite or MovieClip?
View 1 RepliesI just tried to use a sprite mask another movie clip .But it doesn't workis there any way to try thishere is my code
ActionScript Code:
sp = new Sprite();
addChild(sp);
[code]....
I want a class that I'm going to pass a short bit of XML data And then I want that class to create either a Sprite or Clip that consists of an image and some text based on the XML data Example my XML might look like
<root>
<image url="whatever.com/image.jpg">
<name data="Blanius">
</root>
I know how to get to the data what I'm looking for is the best way to create this Sprite on my stage.should the class create a sprite or clip?should the class called to create an instance and then I addChild in my core script?
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].....
I've got a sprite which I want to temporarily hide... But changing the .visible property doesn't do what I expect. The code looks roughly like this:
[Code]...
I created a new AS3 document (550px by 400px) and added the following code to the first frame.
However, when I run this, I see nothing painted on the screen at all, the screen remains completely white.[code]...
I'm doing a simple rotation on a sprite but there's a weird behavior where the sprite does not rotate around it's top left. I think I'm rotating along the top left of the test class instead of the sprite child. I would like to rotate the rectangle around it's top left corner (kinda like a clock hand). The code is pretty short so I'll let the code + pictures explain my problem:
package
{
import flash.display.Sprite;
[Code]....
I've read a lot of stuff about rotating around a fixed point, I've tried doing it with movieclips instead of sprites, I even copy pasted a tutorial on rotation and nothing works.
[Code]...
Then the numericStepper is drawn as if it is squished to 20% its normal height. If I pre-set mySprite width and height before adding the numericstepper, the trace output is 0,0 after adding it and it is not displayed at all. Is there some way I can make the sprite only adjust to correctly fit the numericStepper OR resize it afterwards without distorting the numericStepper component?
Both of sprite.width and sprite.scaleX can be used for scale a sprite. Is possible sprite.scaleX depends on screen size?
View 2 RepliesIt has been a great resource of the years. No my problem. I am trying to dynamically resize a sprite that has a line drawn into it. Here is my code:
[Code]...
first i have 2 sprite.. it`s mcproduct sprite and mcproductpane sprite . mcproductpane is a parent of mcproduct sprite.. so inside mcproductpane there a several mcproduct sprite.this is a script of mc prodcut
PHP Code:
[Code]...
The problem is i want to set a button in here(mcproductpane sprite), this button will unload / make dissappear an image that i load using loader class in mcproduct sprite..how can i make this happen?when i want to make a button in mcproductpane sprite which the function of the button it`s to unload/make an image that i load using loader class in mcproduct sprite disappear.
Everytime I google this question I see confusing information about masks and blends, none of which seems to directly apply to what I think should be an easy thing... There are three Sprites involved here...the lowest layer sprite is pretty much a background. I want to overlay a translucent Sprite on top of the background and then I want the third, top-most Sprite to act as a hole, so that the area inside the third Sprite is completely transparent, so that the background sprite is completely visible. How would I go about doing this dynamically (i.e. dynamically drawing the masking sprite and hole using the Actionscript graphics calls)?
View 4 RepliesIs it possible to set the height of the sprite depending on the height of an textfield inside that sprite? I'm creating a box with a textfield inside it, but I want the box to be sized depending of how much text it is in the textfield..
View 9 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 RepliesIve got a question that feels like it should be easy but I cant figure it out. Suppose I have 2d grid of square sprites on the stage, lets say 20 by 20 (400 sprites). Another sprite moves accross the stage on top of the grid. The moving sprite and the 400 sprites below it share a common parent. So heres the question: How do I find out which of the 400 sprites the moving sprite is currently over? And heres an extra wrinkle: I lied, the sprites are not square they are of differing shapes so I cant do a simple math calculation.
All I can come up with is something like hitTestPoint(), but then I would have to call it 400 times wouldnt I? That is probably the most inefficient way to do things. Is there a function like whatsUnderThisPoint(p : Point) which will return a list of every sprite on the display list that contains p?
I have a sprite and when it is added to the screen, I want it to be added on top of everything else on the stage.What is the best way to ensure that a sprite when added, is on top of everything and not hidden behind other sprites?
View 4 RepliesI am trying to use the scale9Grid on a Sprite but it keeps throwing an error.
Code:
private function drawNameFile() : void
{
var nameField : Sprite = new Sprite();
var background : Shape = new Shape();
[Code].....
q1)when would I use a sprite in a game? eg private var sp:Sprite=new Sprite();
Currently I load bitmaps and bitmapdata fro frames.
q2)My player class extends Sprite but does Sprite class speed things up or it is better to use when I have many images?
q3)If I use a Sprite how t=do I get the Bitmap out of it to use with bitmap collisions test?
I am trying to add a dynamically drawn vector to a loop using a sprite,I 'm not to sure what i'm missing. ( using cs4)
View 2 RepliesI don't know, whenever I try to make a sprite animation and I click on Trace Bitmap, it shows a loading bar, I wait and wait, and when about more then half is done loading, and a little is left, the screen freezes, and I cant even click cancel to stop the loading bar.
View 6 RepliesIn 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 want to rotate a sprite in 3d using AS3. The example below, tells how to do rotate an image using MXML and AS3, however, I want to do it through pure AS3
View 2 RepliesI am completely in the woods here - i have a sprite with a shape drawn in there (there are two different sprites in the example.) At any given point, I need to get the x and y value of the topmost point of the shape. The sprite does rotate so it's going to change at any point as well. I don't even know where to begin here
View 2 RepliesHow do I create multiple instance of the same sprite with different name as in shap1,shape2, shape3, etc. Then the function will change the color of the sprite through getChildByName? Whether I create a new instance, the old sprite will be overwrite by the new sprite and when I call the old "shape1", it will be null. How do I retain all sprite?
var c:UIComponent = new UIComponent();
var s:Sprite = new Sprite();
private function shapeCreate() {
[code].....
I have the following code which creates a series of squares with pictures on them. I then want to scale up the squares on a roll over event. The squares are placed in the x and z coordinates so they look like they are placed on top of each other. When you roll over a square it's scaled up and when rolling out it scales down. The problem is that I want the scaled square to be on top of the rest but I don't seem to be able to figure it out
Code:
ActionScript Code:
/*////////
[code]......
Basically I guess it is a reference problem I do have. (1120: Access of undefined property images)
For an image gallery I also do have a few text sprites which may have to much text for one side to display. Therefore I do have a scrollbar placed next to the text which should be able to move my text sprite within its mask.
My .fla at one point adds an InfoText (InfoText.as, extends Sprite) to an already existing sprite "images".
imageHolderArray[i]=new InfoText (xmlName)
images.addChild(imageHolderArray[i])
imageHolderArray[i].name=xmlName;
[Code]...
The movie I am trying to change will be a patch of grass but if I have a variable sent into flash I want the grass to change to something else such as a road etc.
Is there any function I could use that will be able to change the movie?