ActionScript 3.0 :: Create A Sprite Sheet From A Movieclip?
Mar 7, 2011I'm trying to create from a movieclip a sprite sheet where each frame will be a sprite.
I'm having some problems for create a png which has the differents frames.[code]...
I'm trying to create from a movieclip a sprite sheet where each frame will be a sprite.
I'm having some problems for create a png which has the differents frames.[code]...
SO I am working on animating a 20/fps sprite (an SCV from Starcraft 2). The animation is 1 second long, and thus 20 frames. I have made a sprite sheet in photoshop, and have each frame as a separate layer. I import the PSD into my library and have it convert the layers to "Flash Frames". I get each frame nicely tucked away as a layer in my library. Problem is, it gives an ugly white border (about 1 to 2 pixles thick) around my sprites, making it look like I did a terrible crop job. However, the crop job is fine (I can change the background in the PSD to black, and the cropped sprite frames look perfect! What have I done wrong or need to do?
View 1 RepliesI can cut sprite sheets but i wanted to knoe some tips on getting it perfect right to the charcter so there is no box around the charcater.
View 1 RepliesIn Flash I am able to create a font asset and add it to the library:I want to convert this asset into some BitmapData that will contain all of the characters with the correct letter spacing/line height etc.
Is there an inbuilt way of doing this other than manually creating text fields, adding a character, using BitmapData.draw() and then adding the result to a sprite sheet?
If I need to do it manually like above, is there a way to retrieve all of the embedded characters? For example, in the above screenshot I'd expect only a-z, A-Z. Or will I need to note these manually as well?
I'm trying to generate an animation containing all the frames from a sprite sheet. Then also append them again but flipped vertically. I have an animation class to create the animation, the stuff I wrote just gets the image from the sprite sheet and sends it to this class. But "frame.scaleX = -frame.scaleX;" isn't changing anything, neither is "frame.scaleX = -1;". It's just leaving the bitmap the same..
here's my code:
Code:
for(var i:uint = 0;i < 20;i++)
{
var frame:Bitmap = getFrame(i);
[code]....
Here's a link to a particle explosion generator with many options to play with and it saves a transparent png sprite sheet: [URL] The same particle engine is used in my latest game:Tank Rush. But since my next game will use only sprite sheets for effects, I created this generator out of the tank rush engine.
View 2 RepliesIs the only way to create a style sheet to create Objects for each element?
import fl.controls.TextArea;import flash.text.TextField;import flash.text.TextFormat;import flash.text.StyleSheet;
I do this when a user clicks on a MovieClip:
var style:StyleSheet = new StyleSheet();
var heading:Object = new Object();heading.fontWeight = "bold";
heading.color = "#FF0000";[code]...
I'm making a vertical scroller with a mask. The content is inside a movieclip and the user scrolls around it.My problem is, I have lots and lots of content to put inside that movieclip, and I've reached the limit of the sheet. All inside the movieclip. How do I resize the sheet/canvas inside the movieclip so that I can put more info in it??I've googled it, but found nothing.Note: I just want to change the size of the sheet/canvas inside a movieclip and I don't want to change my document size. I'm using flash CS3, AS2.
View 3 RepliesI'm making a vertical scroller with a mask. The content is inside a movieclip and the user scrolls around it.My problem is, I have lots and lots of content to put inside that movieclip, and I've reached the limit of the sheet. All inside the movieclip. How do I resize the movieclip so that I can put more info in it?? What's the max width of a movieclip?
Note: I just want to change the size of the sheet/canvas inside a movieclip and I don't want to change my document size. I'm using flash CS3, AS2.
First off - I am very new to AS3. I have a class that creates some sprites from ones that are in my library (exported for actionscript, thus new classes I guess?). What I want to do is, from my class, be able to create different sprites.
Code:
symbolToUse = "Star"; //this is different, comes as a parameter when instancing this class...
var particle:Sprite = new symbolToUse(); Is this possible?
You can create a movie clip within the Flash Pro interface and then use it with actions script. But how do you create a sprite element in the Flash Pro interface (by that I mean creating it without using action script)?
View 3 RepliesActionScript Code:
var MapBtnArray:Array = [];
var MapBtnSprite:Sprite;
var i:int;
[Code].....
I'm using to code above to create several sprite on the stage, but when I click on the sprite, the index of each trace work just fine (output of J is according to the target i click); however MapBtnArray[j].x keep equals to "0"
I want the coordinate of the sprite on stage, how come what i get is "0" instead?
what I'm doing wrong.i'm trying to create sprites in a for loop.
Code:
while( i < linkNumber )
{
[code].....
I need to move a sprite only vertically on mouse move. How do I implement it with as3?
View 3 RepliesI'm going wrong with this? I'm trying to create a print button and a sprite, but nothing is showing up when I publish.n what I'm missing? Basically what I'm trying to do is create a coupon that can then be printed.
//_____PRINTING FUNCTION_____
var printContent:Sprite = new Sprite();
var printBtn:PrintBtn;
[code].....
How can I create a sprite with a random array?
Code:
var ball:Array = new Array();
var currentBall:Number = Math.random();
Now I want to create a sprite with ball[currentBall]
What I am trying to do is have it so that I can keep creating sprites from a random number like if i wanted every time a user pressed a spacebar to create a new sprite.Is array the best way to do this?
I have tried to create nested Sprite objects. But I see only the bigger square.
var square:Sprite = new Sprite();
square.graphics.beginFill(0xFFCC00);
square.graphics.drawRect(0, 0, 100, 100);
[Code].....
can you create arrays of Bitmap and Sprite Objects? or Custom Objects?
if not, how would you typically create multiple Objects of the same type? just a loop with
var enemy:Sprite = new Sprite();
for(var count:int=0; count<10; count++)
{
enemy = new Sprite();
[Code].....
That way could be fine for many things, but theres other things I want to do.. such as, create an array of wav sounds.... and my program could pick and choose them, so they wouldnt need to load them on demand.. midi files too.
I thought would be coded like this:
var sp:Sprite = new Sprite();
sp.graphics.beginFill(0xFF88CC);
sp.graphics.drawCircle(0, 0, 50);
[Code]....
however, I realize even tho im looping that addChild method, its still adding sp, so do I add a new naming convention in the loop, or should I be adding these instances to another display object.... this seems like such a simple thing to do yet I cant figure it out, I also want to randomize the x and y, but this first seems to be the issue I need to address.
what is the difference between MovieClip and Sprite?
View 1 RepliesMy code is simply looping through an xml file and creating 'pages' (which are later animated).
This has all worked fine but now I want to add a sprite over the entire contents of the page if the contents of the xml contain a URL.
At run-time I can see that the checks for the URL are being processed correctly and that the overlay is being generated, but I cannot "see" it on the page.
The following code is located in a for loop for every page in the xml file:
var page:Page = new Page(); //MovieClip in my library
// ... other stuff
var textMC:FadeText = new FadeText(xml); //load the text from the xml fragment for this page
[Code]....
I now believe it is something wrong with the XML. It is correctly parsed XML (otherwise FlashPlayer would throw exceptions in my face) and it appears that this code works on every page except the second. Further more, if the second page is set as visible (a flag in the XML determins if the page is created or not) then none of the other pages overlay works.
What is the difference between a movieclip and a sprite. Why some programmers using sprite instead of a movieclip? What is the advantage of using sprite? Can we use sprite in the stage? Will the sprite reduce the space occupation than a mc?
View 3 RepliesI 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 want to send a string to a function and then, via the string reference a Sprite. Are theire any other ways to adress a sprite with a String value?I thought this[myString].alpha = 0.5; was gonna do the trick but i keep getting (1010: A term is undefined and has no properties.). I tried every possible solution it feels like. Delaring Strings locally and Global...but i can�t get it to work. And the String is well spelled btw![code]
View 3 RepliesCreating an application for a client and figured now is a better time than any to make the jump from as2 to as3. I've read many articles and books to keep up to speed but I get constant errors everytime I add or change something. Its becoming beyond ridiculous and rather than searching another unrelated google result, I thought I'd post something here.
[Code]...
how do you check whether a certain mc or sprite has any children inside it... does the following do the trick?
[as]
if (mc.length > 0)
{
trace ("mc has children");
[Code]....
It's never been an issue since I always anticipate it but just wondering...
if I put a MouseEvent listener on a movieclip/sprite...
Code:
whatever.addEventListener(MouseEvent.CLICK, clickAction, false, 0, true);
function clickAction(e:MouseEvent):void {
trace(e.target);
}
that traces a movieclip inside the intended target...
I'm working on a pause function for my game. Instead of manually writing code to pause all possible animations that a movieclip has, I wrote a function that runs through its children recursively until it reaches the end. For each child it checks to see if it's a movieclip, if so it will run a stop() on it. This works fine, except that I noticed it wasn't pausing my walk cycle.
Upon some investigation I found that while I created the walk cycle as a movieclip, it is recognized by flash as a sprite when the game is actually loaded. This does not make sense because the walk cycle clearly has more than one frame. Adding any kind of code to the MovieClip will stop flash from seeing it as a sprite, so to fix this I can just go into the animation and add '//' to any of the frames.
Code:
public static function togglePauseChildren(curObject:*):void {
if(getQualifiedSuperclassName(curObject)=="flash.display::MovieClip") {
if(curObject.numChildren>0) {
for(var i:uint=0; i<curObject.numChildren; i++) {
var curChild:* = curObject.getChildAt(i);
[Code] .....
I'm not sure what I'm doing wrong for this simple task. I have a sheet and right now I only want to use a small portion of the sheet. I try to click on the sheet and it moves around. I lock it, and I can't select any part of it. How do I separate it?
BTW does it matter if it's a symbol or just a PNG sheet?
How do I reference MovieClips or Sprites created in the Document class from a custom class?[code]But I have a lot objects I want to reference so using the above method would take to long.I know I can do this to reference a MovieClip on the main stage from a custom class.[code]Would referencing the sprite created in the document class be similar?
View 1 Replies