Creating a text field in actionscript 3

So the Flash developers said, “Hey! Dragging and dropping text is waay too easy. Can’t we just make it harder?”

So they devised a really hard way to do it. As follows:

package {
  import flash.display.Sprite;
  import flash.text.TextField;

  public class TextField_condenseWhite extends Sprite {
    public function TextField_condenseWhite() {
      var tf1:TextField = createTextField(0, 0, 200, 50);
      tf1.condenseWhite = false;
      tf1.htmlText = "keep    on\n\ttruckin'";

      var tf2:TextField = createTextField(0, 120, 200, 50);
      tf2.condenseWhite = true;
      tf2.htmlText = "keep    on\n\ttruckin'";
    }

    private function createTextField(x:Number, y:Number, width:Number, height:Number):TextField {
      var result:TextField = new TextField();
      result.x = x;
      result.y = y;
      result.width = width;
      result.height = height;
      result.border = true;
      addChild(result);
      return result;
    }
  }
}

Reference:

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextField.html


Posted: May 30th, 2008 | Author: | Filed under: Code Reference | No Comments »

HTML Javascript popup window

<SCRIPT TYPE="text/javascript">
<!--
  function popup(mylink, windowname) {
    if (! window.focus)return true;
    var href;
    if (typeof(mylink) == 'string'){
      href=mylink;
    else
      href=mylink.href;
      window.open(href, windowname, 'width=400,height=200,scrollbars=yes');
      return false;
    }
  }
//-->
</SCRIPT>

<A HREF="popupbasic.html" onClick="return popup(this, 'notes')">my popup</A>

References:

http://www.htmlcodetutorial.com/linking/linking_famsupp_72.html


Posted: May 30th, 2008 | Author: | Filed under: Code Reference | No Comments »