Flash Exercise Notes 6
syllabus | schedule | assignments | class notes | web resources | ARTC courses
Additional Flash code
Embedding Fonts


To ensure that the fonts you use show up when people open your file on a PC or a Mac, you need to do one of the following:

Static Text:
  • By default, the font is automatically embedded - but it increases the size of your file.
    You can:
  • Use device font - this will not use the embedded font - it will look on the system for the closest font

    2. Change to Dynamic or Input Text and click Embed - then select an option (characters, only numbers, etc.)


    Publishing Settings:

    To get a full screen Flash file that resizes when you resize the HTML window, make sure you set the following settings:

    Publish Settings:
    HTML
    Percent: 100 x 100
    Scale: Exact Fit

    In the HTML file that it created, modify the BODY to include margin information:

    <body bgcolor="#ffffff" leftmargin="10" rightmargin="0" topmargin="10" marginheight="0" marginwidth="0">

    Play with the margin numbers and also the other settings

    Remember
  • Use a background rectangle of color rather than the movie background color on your SWFs (except Nucleus)
  • Test everything carefully once the SWF are in the Nucleus - the _root will not work once a SWF has been loaded into another SWF.



    Ways of linking your Exercises to the Nucleus site:

    1. Load a Popup window with the new content using JavaScript or call the External Flash class
    2. Have the Exercise SWF load into the nucleus site via loadMovie



    To have a Flash file open a Webpage:

    openwebMC.onRelease = function() {
          getURL("popupWindow.html", "_blank");
    };

    Popup window using JavaScript:

    popupMC.onRelease = function() {
          getURL("javascript:NewWindow=window.open('popupWindow.html','newWin','width=400,height=300,left=0,top=0,       toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No'); NewWindow.focus(); void(0);");
    };



    Popup window using a call to the External Flash class:

    FLpopupMC.onRelease = function() {
          import flash.external.ExternalInterface;

          var destinationURL:String = "popupWindow.html";
          var windowName:String = "myWindow";
          var windowFeatures:String = "toolbar=no, address=no";
          ExternalInterface.call("window.open", destinationURL, windowName, windowFeatures);
    };



    Closing the JavaScript window

    closeJSMC.onRelease = function() {
          getURL("javascript:NewWindow.close();");
    };


    Flash Security

    When you test your Flash file locally and the file makes calls to web pages, Flash, by default does not let you do this for security reasons.

    You have to set the Global Security Settings to tell the Flash Player to trust your own content.

    The best thing to do is to upload your Flash file onto your portfolio page and test it there.


    Attaching the SWF

    attachMC.onRelease = function() {
          this._parent.createEmptyMovieClip("newMovieClip", this.getNextHighestDepth());
          this._parent.newMovieClip.loadMovie("AnimSWF.swf");
    };

    Removing the SWF

    removeMC.onRelease = function() {
          this._parent.newMovieClip.removeMovieClip();
    };

    Replacing the SWF with another one

    replaceMC.onRelease = function() {
         this._parent.newMovieClip.loadMovie("Another.swf");
    };



    Jumping to a new spot in the newly loaded SWF
    anim1MC.onRelease = function() {
    this._parent.newMovieClip.ball.gotoAndPlay(1);
    };

    NOTE: we had to jump to the frame inside the movie clip that is inside the SWF
  •