ActionScript 3.0 :: Working With Multiple Bitmaps?
Jun 23, 2010
The next bitmap I have is the problem. I started with working on creating the playable avatar. He is on the same layer, but he only works if I add him AFTER the tile bitmap has been completed, AND if I call him with a listener.Call me crazy, but this seems to be when it works. The main class builds the tiles into the bitmap data, and while this is running, if the certain tile is where the main character starts, it calls the Hero class, and that class creates the new bitmap data. Doesn't work before running the loop that adds the tiles, nor after. weird right?
View 2 Replies
Similar Posts:
May 6, 2010
I was wondering which method would be the most efficient (run faster)...Lets say I have multiple layering of animations, say a moving sky, then birds, then fireworks ordered respectively. Is better to have one bitmapdata (called BD) then do a copypixel of sky, then bird, then firework at every tick (I'm using a timer) and put it in one bitmap.
Or is it better to have 3 bitmaps (and put into 3 different sprites) with the animations separated, so when I update the birds I don't have to update the sky.share any knowledge on pros or cons of using multiple bitmaps vs using one bitmap in that situation. Aside for the increase of initial memory used.
View 5 Replies
Nov 13, 2010
Is it possible to load a gif image and create a bitmap for each frame in the animatoin?
View 3 Replies
Aug 23, 2010
I've come to notice recently while using bitmap objects in the Flash CS5 (maybe before as well) authoring environment that are less than 4 pixels in width and/or height that they are treated as though they are 4 pixels wide/tall. Many of the bitmaps I use are 1 px wide in one direction or the other, and they are stretched to fill an area. Lets say I have a bitmap that is 20px tall and 1 px wide, and I stretch it to be 100px wide. The "hit area" of the object, or parent objects that contain it, is 400 px wide. So even if you click a significant distance away from the object, it is still selected, and anything underneath that invisible area can't be selected.
I've also noticed that when exporting a frame as an image, the smallest the width/height may be is 4px, and when I click the Edit button in the Properties panel with a Bitmap instance selected, it opens up in Photoshop CS5 and is 4 pixels wide! I'm wondering if for some reason Flash can't handle bitmaps less than 4 pixels in width/height and is treating it as if it IS 4 pixels wide, possibly even adding 3 extra columns of transparent pixels, because if I do the same thing manually, naturally it acts identical to the way Flash treats the 1px wide version. But why? Why can't Flash handle small bitmaps? Seems to me that's more efficient than quadrupling the amount of memory required.
View 0 Replies
Dec 27, 2009
I've been trying to get the hang of working with bitmaps. I can redraw them using draw(), and after some trouble managed to redraw an externally loaded file using copyPixel(). What I can't do is redraw several images loading from XML.[code]...
View 3 Replies
Mar 15, 2012
i got a basic problem with loading a Bitmap from a URLRequest.The problem is, that loading a Bitmap is to much code to write it every time I want to load an Image. So i thought about some function:
var bitmap1:Bitmap = bitmapForURL("test1.gif");
var bitmap2:Bitmap = bitmapForURL("test2.gif");
function bitmapForURL(url:String):Bitmap
[code]......
View 1 Replies
Dec 30, 2009
I have a drag and drop project using bitmaps that were masked using fireworks. All bitmaps are PNG (fireworks files) and one object is GIF. All objects were converted into movie clips.All movie clips from PNG's can be dragged, but they can't be dropped. However, the GIF movie clip responds to both drag and drop.ActionScript worked when all movie clips had GIF's.Is this problem because the objects were masked or for any other reason?[code]
View 3 Replies
Jul 22, 2010
I have a custom Image class that I am using to store individual image information for a gallery application:
package mtm.test
{
public class Image extends Object
{
[Code]....
This is how I would implement the above:
var image:Image = new Image();
//I would be loading external bitmaps but for the example I'll just create new ones:
image[BitmapThumbnail] = new BitmapThumbnail(new BitmapData(65,65,false,0x000000));
[Code]....
Is there a simpler way to do this? I feel that there is a lot of repeated code within the BitmapType sub-classes.
At the least, this helps to avoid a bunch of for loops trying to find the requested size, and it seems portable to situations where more or less sizes of Bitmaps are required.
View 1 Replies
Dec 2, 2010
I am trying to make a frame arround an uploaded picture by repeating 1 image over and over again. The user will have to enter the real dimentions of the picture and the image will be scaled acordingly so that the frame will look as big as it should. The problem is that when I get a bigger pickture and I scale the images something goes wrong and there is some smearing in the movie clip. When I move it to X:0 and Y:0 all is well. When I move it to the center of the screen the smearing is there. Here's the code I use:
[Code]...
View 3 Replies
Feb 8, 2011
I have many base images that I need to combine to construct larger images to draw on Sprite objects. I understand that the beginBitmapFill() method of the Graphics class renders a bitmap on a Sprite's graphics object. So I figure that I need to manipulate the BitmapData object, adding the base images to produce a composite image that I can then draw on my Sprite.
My question is: Is there any clean and relatively hassle free way of doing this? Is there a way to draw Bitmaps to certain locations in a Sprites graphics context? Could you copy a Graphics object onto another at certain coordinates and build it that way?
View 1 Replies
Aug 3, 2007
I have played around with the Dynamically Loading Bitmaps With Smoothing from Tinic U ro as well as somme other advices from people on the kirupa forum. The code works great. I am trying to load different Bitmaps, fullscreen, on the click of a button (or any other event). The images load, but they just stack on top of each others and thus, they don't resize to the stage properly. Here is the code with the attached FLA: ( you'll need 3 jpg named bg1.jpg, bg2.jpg, bg3.jpg, all in the same folder as the fla)
[Code]...
View 3 Replies
Jul 31, 2009
I'm trying to figure out the best way to compare a single bitmap against perhaps an array of saved bitmaps to see how close of a match it may be to any one of the bitmaps stored in the array. Right now I'm running a for loop that uses the bitmapData.compare() method to try to compare to see how much of a variance there is but... to be honest I'm at a loss as to how to use the resulting data to do so. Does anyone know of any good method to accomplish what I am trying to do? Forget looking at my code it's a waste of time because simply, it's not working.
View 4 Replies
Jun 30, 2009
I'm new to flash, and this is my first post.I'm using Flash MX Pro, 2004 V7.I have this code in the first frame:
________________________________________
for (i = 0; i < 5; i++){
_root.attachMovie("A","A_" + i, i + 10);
[code].....
View 2 Replies
Jul 26, 2009
I've got two functions that work separately, but don't like to work together. Specifically, function "onEnterFrame" stops working after function "connectT."
function onEnterFrame(){
connectT();
checkBounds();
}
[code]....
View 7 Replies
Jul 9, 2009
I have several movieclips in my project which are being used as buttons, and when you rollover the mc's the content is viewable the entire time the mouse is hovering in the area of the movie clip, once the mouse moves off it disapeers. Great. I have the code that allows this to happen, but i have multiple mc's and only one works at a time. Here is the code:
mc.addEventListener(MouseEvent.ROLL_OVER, overHandler);
function overHandler(evt:MouseEvent):void {
mc.gotoAndStop(2);
[code].....
View 2 Replies
Dec 30, 2011
I'm attempting to create a multiple image uploader (think Coppermine) where the user clicks a button in an SWF, selects a file or multiple files, and then these files are uploaded to a directory. I have a PHP script that handles the uploading a file, and my Flash file iterates over the files in the FileReferenceList and sends the file to this PHP script to upload. The directory path in the PHP script is correct, and permissions set to 777.
The contents of my ActionScript 3.0 class look like this:
package com.yourfightsite.imageupload {
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MouseEvent;
[Code] .....
The three methods at the bottom of the class fire JavaScript functions in my HTML page that add the file names to a file queue widget, and update the percent value next to them, and finally mark them as complete. However, when I select files, they are added to the file queue widget as expected and then nothing. The files aren't uploaded, the files in the file queue widget aren't updated, and no errors are thrown, either in the console (I'm using Chrome) or Flash when publishing my movie.
View 2 Replies
Aug 11, 2009
I am working on an educational project where users access multiple interfaces that teach them scientific concepts and I've come to a snag in the best method of developing these interfaces.As they were developed in the last module the format looked like this. Each interface was a separate swf file that contained all needed code, graphics, and a set of fake data for whatever the interface needed. Each revision of the interface is compiled and displayed through meetings or emails where the actual swf file is sent, we do not have a test server nor do we have access to the internet in the rooms where reviews happen. Currently after the final look and interaction is approved all calls to the fake data are modified to either make database calls themselves, or call functions from it's containing swf file once it is loaded.[code]Obviously I haven't gotten it to work but I'm thinking something along those lines. Any suggestions on a method to do this the best. Ultimately I would like to be able to do this for embedding assets as well. For example a font, currently I load fonts from an external file, which means each FLA needs a copy of that font file and at completion all files load the same text file.
View 3 Replies
Jun 15, 2011
I have some code that needs to read like the following:IF the original position(origX) DOES NOT EQUAL where my object is(this._x) AND delay variable(delay) is set to 0, then I need to display a movieclip. There is an X on the movieclip so users can close it, and when they click the X, the delay variable is set back to 1, so the movieclip won't keep loading.
ActionScript Code:
var delay = 1;
if (origX == this._x && delay == 1)
{
[code]....
View 4 Replies
Dec 31, 2010
I've been developing an AS3 based 2D fighting game engine (like Street Fighter II), and have run into an issue. I'm using if/else statements in my onEnterFrame function to hit test my fighters. This works great in my first if/else statement, but for some reason it doesn't recognize my second if/else statement that follows the first. I know it's not the code, because if I bring the second if/else statement up and place it above the first statement (simply swapping the order), the hit test is successful. Why is it that only the if/else statement that comes first works, but any that come after it don't?
Here's my code:
function onEnterFrame(event:Event):void {
//MOVE THE char1
PlayerBase.players[0].x += plyr1vx;
PlayerBase.players[1].x += plyr2vx;
[Code] .....
I've also attached a .zip file with my published files so you can see the issue in the game (must be viewed in a browser for keys to work correctly). Move the left player using "A" and "D" keys. Make him punch with "Z" and kick with "X". Punch is the first if statement in my code, and kick is the second if statement (not working).
View 10 Replies
Jan 17, 2011
I am working on a project which looks like a crossword puzzle. When you mouse over on the white boxes they will light up. When you mouse over the letters they will have 3d rotations and when you rollover only some specific letters, they will flip some specific boxes.
Right now what happens is, when you mouse over the boxes with letters on them, the letters will rotate but the box will not light up. This is because I have created the box movieclip, with the invisible button inside it, and then just duplicated it in my scene to create a tile. But the invisible button for the letters are on the scene,so it's kinda overriding it.when I tried having the buttons on the scene rather than inside the movie clip, what happened is when you roll over one of the boxes, all of them will animate.
View 1 Replies
Apr 16, 2011
I'm trying to make a moving star field using a for loop and duplicateMovieClip, but when I try to add more than one duplicateMovieClip statement, it ends up only doing the last one... so for example, with the sample code at the bottom, it would only make 20 small blue stars, instead of doing each one. I have no idea why it wont do each one, probably because im really new to Flash, and Actionscript.
[Code]...
View 2 Replies
Dec 21, 2010
I try to run a swf or html file of my fla file and it only works on my machine but not on my laptop. I have the latest flash player installed but it still doesn't work. My laptop works for single scenes swf and html but not for multiple scene file.
View 5 Replies
Dec 17, 2011
I'm very new to Adobe Flash CS5.5. Can you create a common instance EG: "Enemy" and then control it like so:
Enemy.x += 1;
So that all instances of Enemy will move forward one pixel each frame? Instead of just one enemy? If this is not possible could I set up some sort of array of enemies like you can in C and try something like:
int EnemyNo = 1;
for(EnemyNo = 1; EnemyNo < 5; EnemyNo++) {
Enemy[EnemyNo].x += 1;
}
Does Flash even support "for" loops?
View 21 Replies
Nov 17, 2010
Got 9 MCs which I want a rollover effect for. I made 1, copied it and it's instance name 9 times. And made this script:
Code:
function menu_btn_over() {
myTween = new mx.transitions.Tween(_root.main.menu.btn.btn_parent, "_x", mx.transitions.easing.Strong.easeOut, _root.main.menu.btn.btn_parent._x, 0, inspeed);
[code]...
But it only works for one of the buttons. The one I made the copies from.I figured you could do this since it's the same MC? I could be wrong though. If that is the case, is there some way I can make the same action for every button without having to make a bunch of calls for each one? for example:
"_root.main.menu.btn1 <and> btn2 <and> btn3 <and> etc.onRollOut = function() {"
View 1 Replies
Nov 17, 2011
Are there any audio management libraries for ActionScript 3? The more tailored they are for game development the better.I'm finding it hard to understand and work with multiple channels, which is making a lot of my audio sound screwy and cancel each other out, etc. I've been working on an RPG that can at a given time have quite a number of sounds playing such as environmental noise (like opening doors, thunder, rain, etc), walking enemies, inventory sounds (for events like dropping an item into your inventory), passive spell-casting sounds, voice clips, weapon swinging etc. Alternatively, if there are any good resources that explain how to use multiple sound channels strategically.
View 1 Replies
Aug 12, 2008
Got 9 MCs which I want a rollover effect for. I made 1, copied it and it's instance name 9 times. And made this script:
[Code]...
But it only works for one of the buttons. The one I made the copies from. I figured you could do this since it's the same MC? I could be wrong though. If that is the case, is there some way I can make the same action for every button without having to make a bunch of calls for each one? for example:
[Code]...
View 7 Replies
Jul 10, 2009
I have Multiple movieclips that when you hover over, a info box pops up and stays active until the mouse is moved away from the info box. Simple enough. I have multiple movieclips and i cannot get more than one to work. In order for the movieclip to work the instance name is 'mc' and this is the code i am using:
[Code]....
View 2 Replies
Oct 10, 2009
In the first frame of an fla I have the code below, only the functions in red works. When rolling over the second only the first function in blue works but the mouse freezes when attempting to rollout (green). But if I remove the code from the first frame and code each seperate button the functions work.
Any reason for this
stop();
btn_shopping.onRollOver = function () {
gotoAndStop(2)_root.main_mc.gotoAndStop(1065);
} btn_shopping.onRollOut = function () {
gotoAndStop(1)_root.main_mc.gotoAndPlay(162);
} btn_pen.onRollOver = function () {
gotoAndStop(3)_root.main_mc.gotoAndStop(1066);
} btn_pen.onRollOut = function (){
gotoAndStop(1)_root.main_mc.gotoAndPlay(283);}
View 2 Replies
Apr 7, 2010
I have created my own file upload flash app that has been working great for me up until this point. It uses PHP to upload the files and sends back a status message which gets displayed in a status box to the user. Now I have run into a situation where I need the HTML to pass a parameter to the Actionscript, and then to the PHP file using POST. I have tried to set this up just like adobe has it on [URL] without success.
Here is my Actionscript code:
import fl.controls.TextArea;
//Set filters
var imageTypes:FileFilter = new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png");
var textTypes:FileFilter = new FileFilter("Documents (*.txt, *.rtf, *.pdf, *.doc)", "*.txt; *.rtf; *.pdf; *.doc");
var allTypes:Array = new Array(textTypes, imageTypes);
[Code] .....
The flashVars variable is the one that should contain the values from the HTML file. But whenever I run the program and output the variables in the PHP file I receive the following.
//Using this command on the PHP page
print_r($_POST);
//I get this for output
Array (
[Filename] => testfile.txt
[Upload] => Submit Query
)
Its almost like the parameters are getting over written or are just not working at all.
View 3 Replies
Apr 4, 2011
So I made a drag and drop app where I can drop in an image, it get's resized and saved automatically on the desktop.
But now I want to do the same when there are multiple images dragged in. This is where I'm stuck...
private function onDrop(e:NativeDragEvent):void
{
trace("Dropped!");
var dropfiles:Array = e.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array;
[Code]....
The problem is that I want the completeHandler() to run after every ldr.load() but in my code it only runs once right after the for each loop.
View 1 Replies