Skip to main content
chienbleu
Known Participant
Mar 16, 2024 4:18 PM UTC
Question

how do Istore and simplify drawing information in AS3?

so i started making a drawing program on anctionscript 3 and my coding skills are extremely basic. i know event listners and variables and children and stuff and i've made some simple projects like the snake game and a very unfinished horrendous version of 2d minecraft.

However i want to make so whatever i draw replaces what was in that area before rather than just adding on top because that makes it start to mag after a while. (i can't share the file because it's on my laptop which my mom is using) the only problem being i don't know how to do that. and i also want to know how to store the information so i can make different frames that load that information. please please please tell me how.

This topic is closed to new replies. Start a new post to keep the conversation going.

15 replies

JoãoCésar17023019
Community Expert
Community Expert
Mar 18, 2024 9:28 AM UTC

Hi.

 

Please make sure you're calling the clear method from the Graphics class appropriately or that you're not adding new instances of your drawings unnecessarily in each frame.

 

This example may give you an idea:
https://github.com/joao-cesar/adobe/tree/master/animate%20cc/as3/scratch

 

Regards,

JC

Translate
chienbleu
chienbleuAuthor
Known Participant
Mar 20, 2024 3:00 PM UTC

yeahh im still not exactly sure how to do that.  I'm using the moveTo() lineTo() method but it seems your project just creates a whole bunch of individual spots that mask the image but it's very laggy that's what i'm trying to avoid. i also want to know how to ACTUALLY erase  

Translate
chienbleu
chienbleuAuthor
Known Participant
Mar 20, 2024 3:01 PM UTC

rather than just changing the colour to white i mean. i just don't know how to manage the strokes

Translate
kglad
Community Expert
Community Expert
Mar 16, 2024 4:25 PM UTC

using code:

 

create a movieclip 

add to stage

apply drawing code to that movieclip.

 

when you want to clear the drawing:

 

remove the movieclip from the stage

null the movieclip 

 

Translate
chienbleu
chienbleuAuthor
Known Participant
Mar 17, 2024 4:54 AM UTC

that only clears the drawing. i just wanna have the parts that get drawn on to be replaced

Translate
kglad
Community Expert
Community Expert
Mar 17, 2024 1:27 PM UTC

what determines what is removed?

Translate