Click or not to Click
We add a click to our newly loaded image and load a new image when the user clicks on our image.
Video Transcript
00:00All right, so let me before we do that or before because we can do that as our last thing here
00:04Or we could have we're gonna choose between two and you guys decide between or when I click on the image
00:10it will load the next image or
00:13Animating the image in what would you guys prefer doing and obviously if you have any question, please feel free to ask right now
00:20As well, let me just get rid of that
00:23Bandwidth profiler
00:25So it's gonna be a democracy. So
00:28First let me feel free to ask. All right, so we have your a split half half
00:39So it looks like it's a or my decision or Alex
00:42Which is rough?
00:51Yeah, I think it's not fair to put this one on Alex. So how about we do the animation quickly and then we do the click quickly
00:58Huh? I will for all just do it. We'll do both really really quickly now
01:05I don't have the tween max libraries right here right now
01:10But you know what instead of doing it right here
01:13Danny, I'm just gonna upload onto our forum onto our Facebook bro forum how to do it
01:21How's that? So I'm just gonna add that like so you're gonna see how it works. It's quite quite easy to work with it
01:27Okay, that's cool. All right, so let's do a quick click
01:31So the next thing that we want to do now that we have our image actually already is we want to actually add our event
01:37Listener so we could add the event listener right in our we could just get rid of some stuff. We don't need here
01:43So we could add here another event listener so we could go to our image one
01:46Add event listener and we can add a click event
01:49So we could go to mouse event and again automatically because I'm working fast
01:54Flash is five point five the mouse event is being loaded
01:58So if you're not working with the latest version of flash
02:00Then you have to follow and find those events or download our source code. So on image
02:06click
02:08On image click what we what are we gonna do on image one click?
02:12We're going to we're not gonna create a very clean application
02:16function on
02:19Image click a dot event mouse event
02:25We're gonna really do a dirty job because I want you guys to do the clean job
02:29So what I'm gonna do is I'm just gonna
02:32I'm just gonna create a new loader
02:36Now this is not necessarily the right way to do it. So we're gonna see how to do this one more time later on so
02:44Image two and we could probably just grab all this stuff right here and
02:49Put it up right here. So instead of image one, we're gonna create image two
02:54We're gonna load image two. We're gonna add these events to image two
02:59Alright now on complete instead of doing it on complete
03:02We're not gonna create an on complete for this one
03:05because we're gonna just
03:06slap it on the stage because I really want you guys to really finesse this because what I really want you guys to do our
03:11progress bar is
03:14Dynamic it doesn't really care what is loading because we're using our event
03:17But our on complete does care and if we wanted to be able to click at every time you click another image will come
03:23We have to make this on complete smarter and not actually talking directly to a specific thing
03:29So as we load new things it would know how to find the next one and the next one and the next one
03:33But we're not gonna do that in this round what I'm going to do
03:36I'm gonna add it directly to the stage image, too
03:40But I'm still gonna keep the progress bar now only problem with the progress bar right now
03:44Is that it's gonna be stacked underneath the previous image to solve that problem?
03:48I'm going to go to add the child one more time, even though it's already on the stage
03:53It was called MC pre-loader
03:56I believe pre-loader and what that would do is it's going to push it up in the top of the chain
04:01So I'm loading Albert one more time. We're using the same exact image creating a new loader info
04:07We're adding that loader info image directly to the stage, but the image is not there yet
04:12So it's going to be invisible until the image will actually appear and then we're starting the progress bar now
04:17Obviously our image is not going to look good because we're not doing all the logic that we're doing for our image inside of
04:21Complete but if we run our application one more time, and let me just before we do that. Let's just look at this
04:25So after we event the first event was completed
04:29We then added a new event listener to image one and said when that image is clicked
04:35Then call that on image click when the on image click was clicked
04:38We created a new image to which was already stored in our as a variable inside of our application
04:44And after that we added our pre-loader again to the stage
04:48So we'll be on top of image one and then we added image two
04:51So we'll be on top of the pre-loader and all we're doing is only listening to the progress report and not to the complete
04:57Because the complete function isn't relevant to it. So let's run it and see what happens
05:05Alright, so we have your Albert and when we click on Albert one more time. It's gonna not work. Oh
05:12Here we go. We click on Albert and the pre-loader popped up to the top and after it popped up to the top
05:18It's going to drop that image
05:22Right on top of everything
