Drawing with Images
Ever want to use an image to draw such as using an image as a fill for a shape. well you will be very surprised at how easy it is to do it. lets jump right in...
Video Transcript
00:00to create a background.
00:01So a background that is based off of JPEGs.
00:04To do that is relatively simple as well.
00:07I'm just gonna create a simple shape here
00:09to use for our background.
00:10It's gonna be a type of shape.
00:13So I'm gonna create here that new shape.
00:17And I'm gonna go to that shape
00:18and I wanna go immediately into our graphics
00:20and I wanna begin drawing.
00:22But instead of drawing with a fill or a gradient,
00:24I'm gonna choose begin bitmap fill.
00:27Now the big begin bitmap fill expects a bitmap data
00:31and it could accept a matrix and some other goodies
00:34that we're not gonna cover at this stage,
00:36but I do encourage you to play around with it
00:38such as smoothing to make sure that it comes out clean.
00:41If we see that it's starting to get pixelations,
00:43definitely try that out.
00:45All right, so the next step that we wanna do
00:47is we wanna make sure that we have a bitmap data.
00:49We could actually create a bitmap data very, very easily.
00:52And I wanna show you how.
00:53So basically if you go into your source files,
00:55you're gonna find inside of the assets folder the strips.
00:59I'm gonna grab the strips
01:01and I'm just gonna paste it right into our flash file.
01:07And we could delete this from the screen
01:09and go right into our library.
01:11And we'll find in our library
01:13that we have our strips.png.
01:15If I right click, and by the way,
01:16the strips I'm using right now on our Twitter account
01:20and also on our YouTube account,
01:21we might change it in the future,
01:22but just so you know right now,
01:24we're using it both there and there
01:25in case you wanna check it out.
01:27On Twitter, we're everything FLA currently.
01:32All right, so the next step
01:32is I wanna go to our action script line and our options.
01:35And let me just take it a couple of steps slower
01:37because I was running.
01:38If I right click on our image,
01:40go to the properties from the library,
01:42go to the action script tag,
01:44you'll see that there's export for action scriptures,
01:46which is what we wanna do.
01:48And you're gonna see when we export to action script
01:50and image, it will be a type of bitmap data.
01:53Now, the only thing that's left is for us
01:54to make sure that we give this a name that makes sense.
01:56So let's call this bitmap data strips.
02:02I'm gonna copy this name, I'm gonna click okay.
02:05It's gonna tell me that it's gonna create
02:06this class dynamically and that's totally cool with us.
02:09I'm gonna save that and go back into our file
02:12and now we could create a new bitmap data.
02:15So I'm gonna create our bitmap data,
02:17which is gonna be a type of bitmap data.
02:20And I could say instead of a new bitmap,
02:22new bitmap data strips,
02:24which will basically create that new bitmap data
02:26that we need for our graphics.
02:28And that's all we really had to do.
02:29And the next step, all that's left is we could start
02:32be getting bitmap fill and we could just send
02:34our bitmap data into it.
02:37Now that we've done that, it's time to start drawing
02:39whatever we wanna draw.
02:40So we could go in our graphics again, draw rectangle,
02:46and we could choose and we wanna go to stage, stage width.
02:49Oh, we wanna start from zero, zero, right?
02:54And we wanna take a stage width and stage height.
03:01And last but not least, we wanna make sure
03:04that we end our fill.
03:07And everyone, our application will see nothing.
03:10And why do we see nothing is because I forgot
03:12to add that shape onto the stage.
03:14So I'm gonna add child and add that shape
03:16right onto the screen at zero, zero.
03:19And there we go, we have our strips
03:21taking the whole area of our screen.
03:23Automatically, it will start duplicating
03:25that image and repeat it.
03:28So there you go, that's how you create
03:29a background template in two minutes.
03:34And this covers our getting started
03:37with using the graphics API.
03:39I hope you enjoyed it.
03:41Definitely send us remarks, feedbacks, email,
03:43Facebook, Twitter, wherever you want.
03:45If you have any questions, please feel free.
03:47We're always here.
03:48Well, I'm always here.
03:50Over and out.
