• home
  • forum
  • my
  • kt
  • download
  • FSCommand - Quit

    Author: 2007-06-09 12:10:07 From:

    We're going to look at making our own quit button. These ae typically used for full screen presentations, or perhaps even games, to close the stadalone projector. To do this, we use the fscommand, which has many uses, but we're going to focus on the quit command. Obviously we're not going to create a huge slideshow or presentation for the sake of learning about the quit function, just some text that we can apply the command to.


    Step 1

    Start by using the text tool to write some text on your stage. In my example, I wrote "[close]". You might also want to use an X which usually signifies closing the window. Once you have drawn that on your stage, select it with the selection tool, then convert it to a symbol, by pressing F8. Select button from the behaviour list.





    Step 2

    Next we need to open the Actions panel. To do this, press F9. If you are using Flash 8, turn Script Assist on. Make sure the button is selected, not a frame. Now to add the fscommand, click the small blue cross to add an item to the script. Select Global Functions > Browser/Network > fscommand, or type escape + fs as a shortcut.





    Step 3

    If you have Script Assist* turned on, Flash will automatically add the "on (release)" event, because it knows you are applying the Actionscript to a button. The next thing to do is assign the quit command. To do this, click on line 2 of your code to edit it. There is a drop down selector to choose various commands for the standalone player. Select quit from the list.





    You are now finished. You won't be able to work the close button by testing your movie the normal way (Control + Enter), so you will need to save the SWF file onto your computer, to test it. Click your text and the projector should close. There are other commands within the fscommand action, which we will look closer at in subsequent tutorials.


     *If you are using Flash MX or MX 2004, you won't have Script Assist. In which case, simply type out the code, as it is fairly short and basic. Alternatively, just copy and paste it into your ActionScript panel from beneath.

    on (release) {
        fscommand("quit");
    }

    Today you'll learn how to create a custom cursor, to replace the regular white pointer. This is often seen on Flash websites and within games, if the white cursor is out of place or takes away from the theme of the site. This tutorial was made with Flash Professional 8, although most, if not all can be done in previous versions.

    For this tutorial, you should know your way around Flash. We are going to replace the cursor with a target. Click


    Now, draw a vertical line with the same stroke settings, using the line tool. Select the line, and copy it. Place it in a similar position to this:





    Paste the line, and position it on the bottom of the circle.





    Paste the line two more times. This time they need to be positioned on the left and right hand side, horizontally. To flip them horizontally, select them, and go to Modify > Transform > Rotate 90 degrees CW.





    Adjust the four lines so they are symmetrical. To make it a little more realistic, select the Oval tool once more, and add a small red dot in the center.





    Now you have finished the cursor. Select the entire target by pressing Control + A. Convert it to a movie clip, by pressing F8. Call it "target". Now we need to add the Actionscript. There isn't much code to do this, but it will be explained afterwards.


    Code:

    onClipEvent (load) {
     Mouse.hide();
    }
    onClipEvent (enterFrame) {
     this._x = _parent._xmouse;
     this._y = _parent._ymouse;
    }


    The first onClipEvent hides the standard white mouse cursor. The second ensures that the position of the movie clip is always updating, and following the invisible cursor. The X and Y is referring to the X axis and the Y axis, which the movie clip moves along.

    Now you're finished. Test your movie by pressing Control + Enter. You should be able to see your target following the mouse cursor (which is hidden). To view the example of what it should look like, click here. here to see an example of how it could be used within a game. (Drag the gun and grenade into your Inventory).

    Introduction

    Dragging and dropping is used everywhere. Not only in general file moving and placing, but also within games. It my be necessary to move a certain item elsewhere for a puzzle or adventure game. We're going to take a look at the basics of dragging and dropping in Flash. It is a very simple effect to conquer. It only requires a few lines or Actionscript to work, and I shall explain what the Actionscript is telling Flash to do. If you would like to see an example of what you can create, click


    As you can see, we have the text "KnowFlash" which is converted to a symbol. We also have a box with the ".com" part, so when the text is dragged and placed into the box, "KnowFlash.com" will be seen.


    Stage 3

    We now need to make the text actually draggable. To do this, we use a small amount of Actionscript, which we add to our movie clip. Select it, press F9 to bring up your Actions panel and add the following code:


    on(press) {
    startDrag(this,false);
    }

    on(release) {
    stopDrag();
    }


    This tells Flash to begin dragging the symbol once it has been pressed with the mouse button. It then says on release (when the mouse button is released, after it has been dragged), stop the dragging. If you test your movie now, by pressing Control + Enter, you should be able to drag your item around the stage. As mentioned previously, this has many uses. Click

    discuss this topic to forum

    relation tutorial

    No information

    Category

      3D (36)
      Math Physics (18)
      3rd Party (10)
      Navigation (70)
      Actionscripting (228)
      Optimization (17)
      Animation (166)
      Projector (11)
      Audio (54)
      Special Effects (170)
      Backend (26)
      Text Effects (92)
      Drawing (34)
      Tips and Techniques (58)
      Dynamic Content (38)
      Tricks (8)
      Games (114)
      Utilities (24)
      Getting Started (99)
      Video (59)
      Interactivity (48)
      Web Design (37)

    New

    Hot