Best Method For Saving API Drawings?
After a person draws something, what is the best way for me to capture that data and save it. This is what I am talking about: http://kendude.com/experiments.html
Thanks.
FlashKit > Flash Help > Flash ActionScript
Posted on: 04-23-2004, 08:36 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Saving Drawings
I have created a drawing API in Flash MX Professional 2004 and i was wondering if it is possible to save the drawings and then viewing them at a later date.
Thanks
Saving Drawings
Hi All
I basic question here, I aint after any code I just need a point in the right direction.
So ultimately I want to create a simple drawing application. the twist is though I need to some way remember the drawing someone has done, like a save function.
Someone will draw a simple drawing and I want them to save the lines, so the can load the simple line drawing they do next time they come back.
Now is there a way I can record where the line is made on the stage by co-ordinates, or can i save a movieclip as a vector images (SVG i think) some how??
I have been searching for a while now, i have instructions on how to draw but not saving. any ideas/link would go down a treat
Thanks in advance
Sam
[F8] Saving User Drawings
I have create a dynamic drawing pad for my website users (Online Notes), however I would like to save what they draw on to the canvas (_root).
Is it possible to save what the user drew on the _root or will I need to create a blank canvas for the user then serialize the canvas and store it into a SharedObject?
Flash Drawing Pad - Saving Drawings To Database
For the use in a collaborative webapplication. We are looking for a flash drawing board that enables the user to save the drawings to an image in a database - (Using PHP if needed).
Anyone seen anything like that out there?
Saving Drawings From Paint Online Application
Hello,
I was wondering if you could help me with this one, please: I would like to make a drawing application where users could save their drawings in a sql database or, if that´s not possible, a .swf file that would be saved in my server disk space. Is that possible?
Many thanks in advance,
Chico
Saving Drawings From Paint Online Application
Sorry for the double posting! that should go into the Actionscript forum. Administrators, please fell free to delete this one
Hello,
I was wondering if you could help me with this one, please: I would like to make a drawing application where users could save their drawings (in swf / vector format, preferably) in a sql database or, if that´s not possible, a .swf file that would be saved in my server disk space. Is that possible?
Many thanks in advance,
Chico
Edited: 11/09/2007 at 04:46:10 AM by foq
Saving Drawings From Paint Online Application
Hello,
I was wondering if you could help me with this one, please: I would like to make a drawing application where users could save their drawings (in swf / vector format, preferably) in a sql database or, if that´s not possible, a .swf file that would be saved in my server disk space. Is that possible?
Many thanks in advance,
Chico
SketchPad HELP - Saving/Redrawing Dynamic Drawings...
Hi guys
I am currently making a sketchpad in flash, the user can draw dynamic squares, line, circles, freehand etc....
I need to be able to save what the user has drawn, or click a "redraw" button and then flash re-creates what the user has just drawn.
Each different line, circle etc is draw in a new movieclip on a higher depth than the previous movieclip.
Does anyone know how to do this, or any good tutorials or .fla files I could use to help me!?
Many thanks
Jonny
Best Method Of Saving?
Hey i have several variables (probably 10-30)
what's the best method of a user saving and then returning to continue with pre-set variables?
i know you can copy a text field ;
Quote:
<59x954><569x48>...etc..
seen here; http://www.xgenstudios.com/dragracer/index.htm
and you can use SharedObject.
but the first you have to have a big text file with you, and the second you can only use on the computer you saved it on.
Help! please!
Saving Undefined Method Calls
I remember reading a book which talked about a special method that would handle calls to methods that didn't exist, but I can't remember which book. Anyone know what I'm talking about?
Method Of Saving Array To Later Recall
Hi All
Ive just finished making a pretty good drum machine by making use of arrays and timer functions.
What I now want to consider is a way of storing the arrays which will contain the users drum patterns, as there is no way to record audio or save onto the users computer via flash. After being stored these could be recalled by the user when online.
I have some server space, and was wondering is there a way to send the array information onto the server to be retrieved by the user at a later date thus creating a method of saving. Can anyone give me a push in the right direction please? THX.
Drawings
i created a movie in which i draw lines to create a somewhat lightning beam using actionscript but ever since i put a movie clip on the background the lines are either invisible or just gone so my question is is there a way to place the mc containing the lines above the backgroundmc ?
Overlapping Drawings
You know that when u do all the drawings in flash, if they overlap they'll "join" or erase each other. Is it possible to disable this as a whole? I know that you can transform into a symbol, group or place in a different layer but it's really quite troublesome. Thanks
Transition Drawings
hello could some please tell me how i can do transition drawings in flash
Thank You!
Making Drawings
Guys I want to make a flash movie that uses lots of different sizes of arrows. I am having a hard time drawing the arrow head, i m using line tool. I dont get the equal angles on the arrow heads. plz help.
I am trying to build a intro file similar to the one in the this website >>>http://www.websitetemplates.name/flash-intros.jsp The template that I am interested is the one in second row and second column.
Thanks
Looking 4 Frame Drawings
I want to show some students how to put together an animation. I would like to show them individual screen frame drawings to show this development process. does anyone have any simple examples which they wouldn't mind me printing out and displaying as an example?
Thanks
Flash Drawings
For good animations.. you need good drawings!!
I will draw anything you ask me to cuz im such a saint .. Simply message me and tell me what you need - object/ tree etc.. background/ hell etc.. Im not charging lol nd no funny busines.. Jus doin sum nice deeds..
Feel free to ask me to draw anything.. and hurry up before i lose my Enerjectic Moment nd then tell you all do em ur selves mwahahahh ahahh ha ..
Andy
(Drawing depending on whats requested.. for e.g. A Japanese Manga tree.. I will simply draw in flash.. with all the details in ONE SYMBOL.. SO all you have to do is download the file and simply cut/copy the Keyframe or Symbol and then paste in to your own movie..Please allow 2days for notifying of your drawing being completed.)
Using Hittests With Api Drawings
I have got this for my line drawing:
var xx:Number;
var yy:Number;
this.createEmptyMovieClip("line", this.getNextHighestDepth());
line.lineStyle(1);
onMouseDown = function():Void{
line.moveTo(_xmouse, _ymouse);
};
onMouseUp = function():Void{
line.lineTo(_xmouse, _ymouse);
}
and for the gravity and bouncing (on my ball) i have got:
onClipEvent (load) {
ySpeed = -2;
gravity =5;
bounce = .9;
ground = 350;
}
onClipEvent (enterFrame) {
if (_y<ground) {
ySpeed += gravity;
} else if (ySpeed>gravity*4) {
_y = ground;
ySpeed *= -bounce;
} else {
ySpeed = 0;
_y = ground;
}
_y += ySpeed;
if (hitTest(_root._xmouse, _root._ymouse, true)) {
xSpeed = (_x-_root._xmouse)/2;
_y--;
ySpeed = (_y-_root._ymouse-_height)/1.5;
}
}
how would i make it so that if the ball hits the line i drew it will bounce up?
How To Save Drawings?
I have a drawing application where user can draw circles, boxes etc.
Is there any way to save that drawing to a jpeg file or swf file or send the final drawing by email?
Thanks for your help.
[Flash] Drawings
Hi there!
It's some time ago I make a question in this forum, but I guess it fits the topic quite well.
I was experimenting for some time now the posibilities of form tweening (even more after seeing some videos of the working by FI) and found that it gets innacurate when the vertex number varies between the start and the end of the tween. This is not a real problem if you work on modifications of the same form. Or that was what I guessed once. Next I noticed that when gaining in complexity, there appears extra vertexes "out of nowhere".
This is not desirable, as you can imagine... I wonder if there's a way to avoid this, appart from "keeping it simple", 'cos it's not allways possible, right?
//And if there's a "flash drawings" forum, I appologize for not noticing it
Vector Drawings--- AAAAAAAARRG
hello!
aah my second post... well I'm currently a Photoshop fan, and now I'm working on Flash. What I like to do is create a new layer over a picture of a drawing, trace over it, color it in and give it a background... So in Flash, I tried this, but whenever I go to use the paintbucket, it doesn't always fill... It's like I have to paint around the edges of the pencil in order to make it "fillable". help!! am I doing something wrong?? I'm new to flash and vectors, so i thought I'd ask, because sometimes it fills without any outlining, but other times you have to outline it with the paintbrush... help! thanks!
[f8] User-made Drawings And More
Hi,
I am new to scripting things in Flash, and I was wondering if I could have some help with a project. Essentially what I want to do is create a box that users can draw in, then save their image, and reflect it horizontally, vertically and both (so it creates a sort of mirrored symmetrical design in 4 attached quadrants). So, if that wasn't clear, the idea is for a person to just design 1 box, and then the others will produce themselves based on the user's original image.
I found a tutorial explianing how to make buttons for line thickness and different colors, but what I don't understand is how to be able to draw in only a specific area, and how to use that finished image to duplicate/reflect, etc.
Any help would be greatly appreciated!
Demonstration Of The Actionscript Drawings API
i am new on a flash and i have been assigned to draw a simple drawing, that dispalys as a house, i have no idea to do this, was wondering if some1 could point me to the right direction, on how i could draw shapes that enables me to edit them and make a house in a MovieClip Class
Vector Line Drawings?
Does anyone know where there might be some good places to learn how to do some scripted drawings using only lines. For example, if you wanted to draw a car begining with only one line and watch as the whole thing took shape, finally ending with the finshed car looking like a blueprint sketch.
Is there a place where they might have some tutorials for this sort of thing. I'm sure that I could make a movie where I just drew every part of the car but that wouldn't look all that great when finished so I wanted to know if there would be a good way, like scripted movement, to make the motion smooth.
Anyone know??
Dynamic Drawings To Showcase At FlashForward NY
Hello everyone, I am speaking at FlashForward in New York on "Dynamic Drawing in Flash MX." I would like to show off some creative examples using the shape drawing API. Post your URLs in this thread or email me directly, and I'll work them into my session (with credit, of course).
[F8] Upload Online Users Drawings.
Hi!
I'm trying to create a function were you can draw a painting and then upload it
so other users can watch them. Like a paint application on the web were other guests can watch your drawings.
I hope you understand what I mean. Does anyone know how to do this or does anyone know a tutorial were my question is explained.
Thank you for your time.
//Michael
Reading Vector Drawings From Mysql
hi
im working in a project where i have a lot of .fla files with vector drawings inside of them,
what i supposed to do is to create a flash movie to show that drawings but i should protect them from being copied by bots or by users,
so my first idea is to save somehow the drawings into mysql (not as swf because a swf can be decompiled also not as regular image jpg,png,.. etc) and then read the mysql database using amfphp or something similar and send the data to the swf and recreate the image using bitmapdata, so i need to know how to save the drawings to mysql and how to recreate them in the swf.
If someone knows a better way to do all this please tell me
any help?
Disable Drawings Put Into A Drawing Object
hello
in Flash CS3, when you draw anything it automatically puts this into a drawing object which is just stupidly annoying. how do i disable this???
Anyone know??
Thanks
Reading Vector Drawings From Mysql
hi
im working in a project where i have a lot of .fla files with vector drawings inside of them,
what i supposed to do is to create a flash movie to show that drawings but i should protect them from being copied by bots or by users,
so my first idea is to save somehow the drawings into mysql (not as swf because a swf can be decompiled also not as regular image jpg,png,.. etc) and then read the mysql database using amfphp or something similar and send the data to the swf and recreate the image using bitmapdata, so i need to know how to save the drawings to mysql and how to recreate them in the swf.
If someone knows a better way to do all this please tell me
any suggestions?
Dynamic Drawings To Showcase At FlashForward NY
Hello everyone, I am speaking at FlashForward in New York on "Dynamic Drawing in Flash MX." I would like to show off some creative examples from our community using the shape drawing API. Post your URLs in this thread or email me directly, and I'll work them into my session (with credit, of course).
Drawings In Flash Dont Show When I Publish Swf
hi guys.
well yeah when i draw in flash and i preview it as flash the drawings show but when i publish it they dont.
ne reasons why this would happen.
cause say i have a bmp image in the background set on layer 1 and then i draw something in layer 2 using the flash drawing tools it dosent show, when i preview the movie in flash it shows but not when i publish it.
but the weird thing is it will always show up if i have nothing else besides the drawing it self on the stage.
ne ideas how i can fix this problem cause id draw more in flash if i new why it does this.
and yes i make it that they are arranged so the drawing is in front and the its layer is above all the others i want it to be. so why does this happen.
thanks hope u know whats wrong.
Anti-alias Problem With Vector Drawings
Hi,
I have a anti-alias problem with my flash file.
My SWF has a solid background-color (##00CCFF) and some vector drawings on it.
When I open it in flash player and zoom in, everything looks sharp, but when we use this SWF on a bluescreen (swapping the background-color with some video image), we see jagged edges around the vector drawings...
Does anyone know how to overcome / fix this problem?
Regards,
Vic.
Paint Bucket Won't Fill Line Drawings
I'm using flash 8.
After i finish using the line tool to draw an enclosed shape, the last last line i drew always remains selected and the Fill colour box in the properties panel always produces a red stroke through it indicating no fill colour is active.
If i select the fill tool at this point, the last line i drew still remains selected and the same red stroke is there and i can't get a colour to replace that red stroke.
In order to deselect the last line i drew, i have to go to the Select tool and then click somewhere on the stage outside the shape i've drawn. This then allows a fill colour to occupy the box in the properties panel - the red stroke is eliminated - hurray!
I then go back to the fill tool and with a fill colour selected i try to fill the object and nothing happens.
If i use any of the other drawing tools - oval, rectangle pencil, brush etc. firstly i don't have to deselect the shape i've drawn with them before going to the fill tool, and secondly they all fill with colour like clockwork, no problem.
I also have similar problem with stroke tool when used with line drawings, again no problem when used with drawings created by any of the other drawing tools.
Could anyone tell me what i'm doing wrong? Much appreciation.
Drawings In Flash Dont Show When I Publish Swf
hi guys.
well yeah when i draw in flash and i preview it as flash the drawings show but when i publish it they dont.
ne reasons why this would happen.
cause say i have a bmp image in the background set on layer 1 and then i draw something in layer 2 using the flash drawing tools it dosent show, when i preview the movie in flash it shows but not when i publish it.
but the weird thing is it will always show up if i have nothing else besides the drawing it self on the stage.
ne ideas how i can fix this problem cause id draw more in flash if i new why it does this.
and yes i make it that they are arranged so the drawing is in front and the its layer is above all the others i want it to be. so why does this happen.
thanks hope u know whats wrong.
Function In A Method Return True To Method's Caller?
I think I probably don't know the correct terminology to ask this question, but here goes:
In this example, can anyone tell me how to have the setComplete event function within the main method return true to the caller of the method, instead of just to the listener?
PHP Code:
function loadAsset(target:MovieClip, asset:String, assetLoaderInfo:LoaderInfo): Boolean { var assetLoader:Loader = new Loader(); var assetURLRequest:URLRequest = new URLRequest(asset); assetLoader.contentLoaderInfo.addEventListener(Event.OPEN, setLoaderInfo); assetLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, setComplete); function setLoaderInfo(event:Event) { assetLoaderInfo = event.currentTarget; } function setComplete(event:Event) { target.addChild(assetLoader); return true; } assetLoader.load(assetURLRequest); }
Function In A Method Return True To Method's Caller?
I think I probably don't know the correct terminology to ask this question, but here goes:
In this example, can anyone tell me how to have the setComplete event function within the main method return true to the caller of the method, instead of just to the listener within the method?
Many thanks!
PHP Code:
function loadAsset(target:MovieClip, asset:String, assetLoaderInfo:LoaderInfo): Boolean
{
var assetLoader:Loader = new Loader();
var assetURLRequest:URLRequest = new URLRequest(asset);
assetLoader.contentLoaderInfo.addEventListener(Event.OPEN, setLoaderInfo);
assetLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, setComplete);
function setLoaderInfo(event:Event)
{
assetLoaderInfo = event.currentTarget;
}
function setComplete(event:Event)
{
target.addChild(assetLoader);
return true;
}
assetLoader.load(assetURLRequest);
}
[AS2 OOP] Calling A Method In A Method
Hi everyone
i'm not quite sure how to phrase my problem, so i'll examplify:
Code:
class A{
function A(){
trace("construct");
}
private function moo(){
trace("moo!");
}
private function cow(){
trace("start mooing");
moo();
}
}
this does what I expect it to: construct, start mooing, moo!
Code:
class A{
function A(){
trace("construct");
}
private function moo(){
trace("moo!");
}
private function cow(){
trace("start mooing");
_root.onEnterFrame = function(){
trace("moo!")
}
}
}
this also does what I expect it to: construct, start mooing, moo!, moo!, moo!, ...
Code:
class A{
function A(){
trace("construct");
}
private function moo(){
trace("moo!");
}
private function cow(){
trace("start mooing");
_root.onEnterFrame = function(){
moo();
}
}
}
yet this doesn't, I'd expect it to: construct, start mooing, moo!, moo!, moo!, ...
yet the moo! moo! moo! doesn't appear, as if moo() never gets called it all.
so what I'm I doing wrong?
For... In ... Method
Hi all,
I have some problem with the
for( iterator in Object ) method
because it iterates on my Object returning properties in reverse order
In other words if I define a Object Person with
Fabio = new Person()
function Person(){
firstName = "Fabio"
birthday = "28-10-1970"
eyesColor = "Blue"
}
and then I use
for (i in Fabio){
trace(Fabio[i])
}
this method returns my Object properties in reverse order
eyesColor
birthday
name
instead of
name
birthday
eyesColor
Is there anyone who can tell me if it is possible to get my Object properties in the same order i defined them?
Any help will be very appreciated
GET Method
I have a PHP script that need two variables...
what is the correct syntax in flash ?
on (release) {
Status = "Beginning registration Process... Please Hold";
loadVariablesNum ("Register.php?RegName="+RegName ????&???? RegPassword="+RegPassword, 0);
}
thnx
A Method Of Self Help
This may sound odd, but for those who are budding flash developers, I think I found a way (aside from buying books and what not) to learn Flash MX commands rather well.
Open Flash MX, Press SHIFT+F1 (Reference), open the INDEX on the left, and one by one click on each and READ!
I've been doing this and what makes it all sink in is that I am writing what I read into a notepad file. The process of both reading and writing (seeing and doing) makes remember not only that object easier, but you know expand your thinking process when a problem presents itself.
Like you can get a eureka moment if a problem exists, and since you remember better what you read, you have an increased chance of formulating an answer with code.
Not only that, but you should try the code out. Set aside some time to test the code you're a little iffy on, and if that doesn't work, do a google search on ACTIONSCRIPT and the keyword you're having problems with.
I'm a forgetful person, and I've been doing these steps and learning SO MUCH. Hopefully it'll work well for others too.
& In Get Method
Hello!
I need to pass some text to display it in my .swf movie i'm using loadVariables to do this: http://myserver.com/content.php?id=1 but in this text there are some Baltic characters like õ, now php outputs it like this: text=ettev& #245;te and when my movie sees the & it treats it like another variable for example: text=tettevote&id=1 here are two variables text and id.
Is there a way around this?
Method In Other Method
Why if I call a method "makeFunction()" it works and if I call the same method fro the method "Down()" it doesen't work?
dynamic class SingleMovieClipEvents extends MovieClip {
private var movieClipPath_mc;
private var functionName;
private var args_array:Array;
private var theFunc;
public function SingleMovieClipEvents(mC:MovieClip, funNa, args:Array) {
functionName = funNa != undefined ? funNa : null;
args_array = args != undefined ? args : null;
movieClipPath_mc = mC != undefined ? mC : this;
setMovieClip();
makeFunction();
}
private function setMovieClip() {
movieClipPath_mc.onRelease = Down;
}
private function Down() {
this.gotoAndStop("down");
makeFunction();
}
private function makeFunction() {
if (functionName) {
theFunc = eval(functionName);
theFunc.apply(this, args_array);
}
}
}
WHAT's The Best Method? . . . .
Best Method for Text ?:
Ok, need a bit of help from some flash experts with a fair few applications under their belt, particularly ones that involved formatted text.
I’ve making an interface (application) that has about 6 different sections, video, multimedia, art, noise, bio’s and poetry text. So far i’ve basically got a “thumbnail” that you click, it then goes to the corrosponding frame in that scene and the movie/file needed loads into a movie/instance in that frame called “blank” (pretty creative naming huh? ;-)).
The interface its self is fairly bais, it stay with the style of graffiti and all things load on a brick wall, using graf fonts and a few tags etc. Most things work fine except for a few hiccups.
My problem is this:
I now have about 250-300 poems to get in to the interface, all with rich formatting (bold, italics, spacing, diff size fonts, etc) and all sent as DOCS. My thoughts were to do the following:
Convert all into RTF files using Appleworks (yes, I’m on a mac) or a similar converter (Vinc seems ok), import each one into Freehand since it seems to preserve most RTF and then bring the resulting SWF file into FLASH, paste it into a basic movie that has a simple scroll bar and then export that movie and name it appropraitely, move onto the next one . . .
I know it’s possible to load fomatted text into Dynamic text boxes from text files but I’ve so far not been able to get a handle on this (am using Flash MX) and I’m not sure it would be able to handle the “aligning” spaces, etc involved. The reason I’m using a scroll bar is that some poems are very long and won’t fit on the “WALL”, otherwise I’d just paste them in a graffiti font and leave it there.
Anyway, could ppl let me know of any pitfalls they see in this method, problems, etc or if anyone knows a better way (or has or has seen any examples of one) then please let me know. Have to get started on this soon and don’t want to be half way through it when some expert points out a brilliant stylish method that I hadn’t thought of that then makes me tear my hair out.
Thanks very much for any help or advice on this, it is GREATLY APPRECIATED.
Cheers
scart
Which Is The Best Method
Hi,
I would like to know, does anyone have any suggestions as to the best way to create a flash video gallery that can be used in a website.
I would welcome any samples or tutorials that may be available.
I would appreciate it very much.
Cheers
Best Method For:
Got a project I need help with and I need to know if the fallowing is possible and if so what would be the best method for accomplishing it.
Need:
Virtually I need to know how to build a small flash GUI that allows users to name their so called "projects" then click a button ("Build") that will copys/pastes a directory and name this copy what ever the user called it on this flash GUI.
Of course this Flash GUI will have to reside in the same folder as the directory its going to be duplicating. I just need to know if I should be looking at XML help or PHP or if action script might be able to do the whole copy and paste while naming actions.
Thanks.
Best Method For This?
hi all, im just creating a quick thing for my dad which has lots of objects on the stage and when the user hovers over an object he wants the object to turn red (50% tint) (the object can also be clicked to go to a different frame)
would it be best to have them all just as buttons, or as movieclips and addEventListeners to them all to the one function?
or is there a different way?
thanks
Dan
Key Hit Method?
Ive got this Key class, to replace what was lost with AS2 (Using AS3):
Code:
// Key.as
package {
import flash.display.Stage;
import flash.events.Event;
import flash.events.KeyboardEvent;
/*
* The Key class recreates functionality of
* Key.isDown of ActionScript 1 and 2. Before using
* Key.isDown, you first need to initialize the
* Key class with a reference to the stage using
* its Key.initialize() method. For key
* codes use the flash.ui.Keyboard class.
*
* Usage:
* Key.initialize(stage);
* if (Key.isDown(Keyboard.LEFT)) {
* // Left key is being pressed
* }
*/
public class Key
{
private static var initialized:Boolean = false; // marks whether or not the class has been initialized
private static var keysDown:Object = new Object(); // stores key codes of all keys pressed
private static var keysReleased:Object = new Object();
private static var wasPressed:Boolean = false;
/*
* Initializes the key class creating assigning event
* handlers to capture necessary key events from the stage
*/
public static function initialize(stage:Stage)
{
if (!initialized)
{
// assign listeners for key presses and deactivation of the player
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
stage.addEventListener(Event.DEACTIVATE, clearKeys);
// mark initialization as true so redundant
// calls do not reassign the event handlers
initialized = true;
}
}
/*
* Returns true or false if the key represented by the
* keyCode passed is being pressed
*/
public static function isDown(keyCode:uint):Boolean
{
if (!initialized)
{
// throw an error if isDown is used
// prior to Key class initialization
throw new Error("Key class has yet been initialized.");
}
return Boolean(keyCode in keysDown);
}
public static function isPressed(keyCode:uint):Boolean
{
if (!initialized)
{
// throw an error if isDown is used
// prior to Key class initialization
throw new Error("Key class has yet been initialized.");
}
if (wasPressed == false)
{
return Boolean(keyCode in keysDown);
wasPressed = true;
}else{
return false;
}
}
public static function isReleased(keyCode:uint):Boolean
{
if (!initialized)
{
// throw an error if isDown is used
// prior to Key class initialization
throw new Error("Key class has yet been initialized.");
}
return Boolean (keyCode in keysReleased);
}
public static function clearKeysPressed():void
{
keysDown = new Object();
}
/**
* Event handler for capturing keys being pressed
*/
private static function keyPressed(event:KeyboardEvent):void
{
// create a property in keysDown with the name of the keyCode
keysDown[event.keyCode] = true;
}
/**
* Event handler for capturing keys being released
*/
private static function keyReleased(event:KeyboardEvent):void
{
if (event.keyCode in keysDown)
{
// delete the property in keysDown if it exists
keysReleased[event.keyCode] = true;
delete keysDown[event.keyCode];
}
}
/**
* Event handler for Flash Player deactivation
*/
private static function clearKeys(event:Event):void
{
// clear all keys in keysDown since the player cannot
// detect keys being pressed or released when not focused
keysDown = new Object();
keysReleased = new Object();
wasPressed = false;
}
}
}
Anyone any ideas how i can add a Key Hit method, so it'll only register when the key is initially pressed, then it'll go back to false?
|