Amazon.com Widgets

So now we have a game where we can collect objects in our room, place them in our inventory and when we drag them from our inventory we can replace them there easily. What else do we need a game to do? Well, within our inventory we want close up views of our objects. We also want to be able to DO stuff with our objects – interact with objects in the room and have them interact with each other. As you can imagine, hitTest will be quite useful for this.

First lets set up our close up views inside our inventory. We’re going to need a frame for each of our objects, with a label, and one for “start” – where we don’t have any close-up views showing. I spread these frames out five frame apart to make it a little easier to look at, but it doesn’t really matter. We create a blank key frame every five frames on our labels layer, labeling frame 1 “start” frame 5 “square_close” frame 10 “circle_close” frame 15 “triangle_close” and frame 20 “key_close”. We need a blank keyframe and stop script at every one of those frames in the actions layer and we need to extend the rest of our layers (background, buttons and objects) all the way through so that they don’t disappear when we’re looking at a close up. Now we’re ready to create layers to hold our close up views. Since all of our closeups will look basically the same except for the object they contain and the text describing the object, we can do this pretty simply. Create the following layers below your labels layer but above the rest of the layers you already have:

closeup1.png

Now we’ll spend some time drawing the close up for our square in our “square_close” frame because we’ll be able to copy and paste most of what we make into our other close ups.

In our closeupbackground layer create a square with a colored background with a 45% alpha level (or whatever looks good) as a background.

On the return button layer create a little button that makes it clear that it will “close” the close up and return to us normal view. A rectangle with an x in it is a good way to do this. Convert this object to a button called “return_btn” and add the following script to it:

On(release)
{
gotoAndStop(“start”)
}

Each of your close up frames will have this button and the script doesn’t need to change because they’re all going to the same place – “start”.

On your objects close up layer, drag an instance of the object (in this case “square_mc”) that you’re taking a closer look at. Give it an instance name like this: square3_mc. This is important if you want to be able to interact with your close up objects. You probably want to size this instance larger since it is, after all, a close up.

On the "no action button" layer, simply create a rectangle the same size as your object background, convert it to a button and set its alpha level to zero. Name it “nothing_btn” or “noaction_btn”. This invisible button with no actions will prevent users from being able to click on objects in the room that happen to be behind the current object closeup.

On your text layer add a static text field with a short description of your object. In this case, mine says “a square.”

Your resulting frame should look a bit like this:

closeup2.png

Now do the same for the rest of your objects. You should be able to use most of the frames (background, closeoff button and return button) and just drag different instances of your objects for the object close up and change the text to reflect that object. Don’t forget to give your larger objects consistent instance names like “circle3_mc.”

closeup3.png