Skip to main content
chienbleu
Known Participant
March 16, 2024
Question

how do Istore and simplify drawing information in AS3?

  • March 16, 2024
  • 2 replies
  • 685 views

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 has been closed for replies.

2 replies

JoãoCésar17023019
Community Expert
Community Expert
March 18, 2024

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

chienbleu
chienbleuAuthor
Known Participant
March 20, 2024

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  

chienbleu
chienbleuAuthor
Known Participant
March 20, 2024

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

kglad
Community Expert
Community Expert
March 16, 2024

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 

 

chienbleu
chienbleuAuthor
Known Participant
March 17, 2024

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

kglad
Community Expert
Community Expert
March 17, 2024

what determines what is removed?