Archive for March, 2010

Re-posting: Creating a quiz game using ActionScript

March 31st, 2010

Today we’ll be looking at how to make a button-based game. We’ll need to run in ActionScript 2. The exciting part is that these games will be able to be put into the teachers’ SmartBoard software. Imagine the school playing a game you created.

    Setting up the Project

  1. Open a new Flash document.
  2. Click on Layer 1, Frame 1. Add a stop(); action to stop the playhead.
  3. On a new line in the code, establish a variable to hold the score.
    The code so far:

    We set up the score variable here so we can change it as the user gets questions right.
  4. Create a new layer in frame 1.
  5. Create text as a title for your game (so the user isn’t staring at a white screen).
  6. Making a Button

  7. That’s great, but we need a way to get past this screen. We’ll need a button. Click on Insert->New Symbol and choose ‘Button’.
  8. Buttons have an Up, Over, Down, and Hit. Up is its natural state. Over is if some hovers a mouse over the button. Down is what it looks like when it gets clicked. Hit is the Hit Zone – if you want a bigger area to register if it’s been clicked on or not. Normally Hit is the size of a box around the button.
  9. Make a keyframe in each area to change the states of the buttons (what they look like). Notice that you can insert multiple layers.
  10. Drag that button onto the stage.
  11. The button is clickable, but it doesn’t know what else to do. With the button selected (blue highlight around it), open up the ActionScript for that button.
  12. Telling the Program to go to the Next Part

  13. Type on( . Remember from previous lessons that when we see the parentheses, it means the function is calling/looking for a variable. Most modern versions of Flash will try and guess which one you want. Select press. (When someone clicks the button, it goes. You could choose release and the user could click and hold and then go when the user releases the mouseclick.)
  14. Add a funky bracket ( { is called a brace, to be technical) to start your list of commands.
    The code should now be:
    on(press) {
  15. Start a new line to maintain style.
  16. Type in gotoAndPlay(2); Notice that the ‘A’ and the ‘P’ are capitalized. Also look at how the function calls a variable – the number ‘2’ – to tell the game to go to frame 2.
    The code now is:
    on(press) {
  17. If you run the program right now, when you click, it will go to frame 2 (or even just consider frame 1 the end of the movie if you haven’t added anything yet to frame 2) but then loop back to frame 1. We need to put a stop(); code in frame 2 just like we did for frame 1. You’ll need to insert a blank keyframe and then click on the ActionScript arrow.
  18. Once you’ve added the stop();, on a different layer create text with your question.
  19. Use the Same Button Multiple Times to Make Your Life Easier

  20. We need buttons for our answers. If we create one button in the Flash library, we can then drag it in multiple times and not have to re-do animations. Create that button.
  21. Drag the button from the library onto the stage. Create a text box next to the button that has an answer.
  22. Drag the button from the library again onto the stage for the second answer. Put a text box next to the button with an answer.
  23. Checking for the Wrong Answer

  24. Click on the button next to the wrong answer to select it (blue outline).
  25. Let’s add some code for the wrong answer. Let’s add a gotoAndPlay(3); to the button (with the on(press) and all that) to take the user to frame 3, which is where we’ll mock them for getting the wrong answer. (Mock them nicely and politely.)
  26. Make sure to add a stop(); code in frame 3 to avoid the jumping loop. You’ll need to insert a blank keyframe.
  27. Create your end of game screen. Be nice and include a button to take us back to frame 1.
  28. Checking for the Right Answer

  29. Let’s say the user got the question right. Go back to frame 2 and edit the ActionScript for the correct answer button.
  30. Send the user to the next question – frame 4 – with a gotoAndPlay(4); What’s different this time, though, is that we need to add to the score. On a new line in the ActionScript type in score = score + 10; We just took the score and added 10 points to it. (It will still complete the rest of your list of commands – but to keep it straight in the minds of the humans who may be reading over your code later, add to the score first and then put in the goto.
    The code should look like:
    score = score + 10;
  31. Displaying a Score

  32. On frame 2, create a new layer. Let’s label what the user is looking at. Create a text box somewhere on the screen that says ‘Score’. If it’s on it’s own layer and it’s own keyframe, it will constantly say ‘Score’ throughout the whole program.
  33. Now let’s show the actual score. Click on the tool to make a text box, but instead of creating a text box, just click where you want to show the score.
  34. In the Properties at the bottom of the work area, change it from Static to Dynamic text. Dynamic and Static are just like with characters in a story – dynamic changes, static stays the same.
  35. In that text’s Properties, there’s a place called ‘Var: ‘ with an input box next to it. Type in score. It will now show the value for score. Make sure that you don’t put this in frame 1, because frame 1 is where we initialize/set up the variable.
  36. Thoughts to Enhance the Game

  37. You can add to score whenever the user clicks on the right answer button. You can subtract from score when a user gets the wrong answer.
  38. You can add as many buttons as you like – you don’t just have to have two questions.
  39. Not all buttons need to be easily seen. You could say “Click on the duck” but have the Up be blank and have the Over show a duck. The user would have to roll around the screen to try and find the right button.
  40. You can create a variable called whichframe to control which frame a gotoAndPlay goes to. Instead of gotoAndPlay(4); it could be gotoAndPlay(whichframe);

This is the book you’re looking for.

March 25th, 2010

We have Star Wars: A Pop-Up Guide to the Galaxy in the library and yes, it is an awesome book.
President Obama bought the book for the Press Secretary’s son.

Barnes and Noble rights the opening day wrong

March 24th, 2010

When I went to pick up Heist Society on its release date, Barnes and Noble didn’t have it yet.

I told them they’d need to correct that.

Here’s what my local Barnes and Noble set up:
Espionage and Adventure from Ally Carter

Isometric Game: Going to the Next Frame

March 10th, 2010

We’ve got the countdown showing on the hero for our game. If you weren’t at Future Professionals when we did that, here’s the link.

Let’s check when the variable scarytimer gets to zero. When it does, we’ll have the Flash movie go to frame two.

Find the line of code in the onEnterFrame function where you decrease scarytimer.

Underneath it, check to see if it’s less than 0.
if(scarytimer<0){ gotoAndStop(2); scarytimer=0; }

The gotoAndStop means that we don't have to put a stop(); code in frame 2. It reduces the amount of typing you have to do.

Notice that I added a line to set scarytimer to 0. Instead of going into the negatives, it's now an ominous emptiness.

Now draw/type a message on the stage in frame 2 that lets the player know that time has run out.

That's if they lose. But what if they win?

Find the line that says
if([hero.y][hero.x] == 101){



On frame 3 create a message that lets them know they win. Make sure that frame 3 has a new keyframe so frame 2's message doesn't show up.

Leadership Qualities in Girl Who Owned a City

March 10th, 2010

This is for Ms. Redden’s 7th grade Language Arts class. We’ll be looking at leadership characteristics in both a modern day setting and in the novel The Girl Who Owned a City.

The first site to look at is the Time Magazine Top 100 Influential People of 2009. You can find the site by clicking here.

Click on a person’s name from the list. Read through the person’s description looking specifically for leadership qualities.

Look at the Venn diagram side of your handout. In the middle of the diagram, write down qualities that Lisa and your person share.

On the left-hand side of the diagram, write down qualities that Lisa has as a leader that your person does not have.

On the right-hand side of the diagram, write down qualities that your person has that Lisa does not have.

The next site you’ll look at is the Top 10 Leadership Qualities from HR World. You can get to the site by clicking here.

On your own, answer the three questions on your handout in complete sentences.

Girl to the Core by Stacey Goldblatt

March 8th, 2010

This is proof that I can and do read books that don’t have giant monsters and/or helicopter chases.

Girl to the Core is a simple story of Molly, a high schooler from a strong Irish family. Her mom passed away when she was little, so she has been raised by her dad and her uncles. Molly must stand up to a controlling boyfriend and a pushy best friend and figure out who she is.

This is a similar plot for many books.

But what makes this one stand out is that her boyfriend pushes her too far at the beginning of the book. Most books have this towards the middle to end of the plot arc. By having Trevor be a jerk up front, we now follow Molly on a journey of how to continually stand up to someone (more realistic than a single confrontation) while she redefines herself.

Another perk is Molly’s Irish family. Many different personalities try to give her differing advice on life with the common theme that they care for her. The family members are written in such a way that you want to be a part of their family.

An added bonus to the book is the collection of journal questions at the end of the book. Molly starts to journal and learn more about what she truly believes. Goldblatt gives readers questions to get their journal writing processes started.

This book is a sleeper hit. You won’t see big publicity for it but Girl to the Core is a necessary read for junior high libraries in modeling how to peacefully/respectfully stand up for yourself.

How Librarians will Save the World

March 8th, 2010

It’s great to see authors like Marilyn Johnson delve into the world of what a modern library actually looks like. Here’s an excerpt from This Book is Overdue that summarizes it pretty well:

Somewhere between Jeanette Moodie’s frontiers and Lena Kjellar’s is the story of a profession in the midst of an occasionally mind-blowing transition. A library is a place to go for a reality check, a bracing dose of literature, or a “true reflection of our history,” whether it’s a brick-and-mortar building constructed a century ago or a fanciful arrangement of computer codes. The librarian is the organizer, the animating spirit behind it, and the navigator. Her job is to create order out of the confusion of the past, even as she enables us to blast into the future.

I also appreciate the acknowledgment that a librarian helps you find your information efficiently, as well as the nod to libraries as a community center. Our local public library is offering business and network classes and helping people with their job applications. In a time where the majority of our population is being hit hard economically, a hub with free access to information is crucial.
Here’s a link to the article from NPR.

AR Goal Calculator

March 5th, 2010

When I taught Language Arts we had a chart where you cross-referenced the grade level score from the STAR test with how many points a student’s goal should be.

The calculator found here does that. It also factors in how much practice time a student has for independent reading in addition to how long the goal period is.

You can create a roster from the web page. The nicer feature would be to include the source code for this directly in your Reading Renaissance account where your rosters were already created.

Gotta Keep Reading

March 4th, 2010

I’ve seen other videos parodying the Black-Eyed Peas’ “I Gotta Feeling”, but this one is fun for librarians:

Also, a congratulations to the school for choreographing that many students.