Adam Tworz’s Blog

February 27, 2009

onRelease

Filed under: Actionscript 3 Migration — Tags: , , , , — admin @ 11:05 pm

Actionscript 2

   mc1.onRelease = function() {
   }
   mc1.onRelease = null;

Actionscript 3

   import flash.events.MouseEvent; // if on timeline we don't need this line
   mc1.addEventListener(MouseEvent.CLICK, mc1_click);
   function mc1_click(e) {
   }
   mc1.buttonMode = true; // to have hand cursor when over it
   mc1.removeEventListener(MouseEvent.CLICK, mc1_click); // to remove action

Further differences:
1. if something is covering it, it won’t work even if invisible it will not work
2. function need to have one parameter or it will not work.
3. we need to remeber to remove this listeners when not needed or we’ll cause memory leaks

February 23, 2009

Custom underline in TextField

Filed under: Flash Tips & Tricks — Tags: , , — admin @ 2:59 pm

I could find any way to make custom underline in TextField. The only what you can have from flash straight out the box is <u> tag which gives you plain line same colour as text. So if you want to have it different colour or style like dotted you need some workaroud. Asfaik you cannot set up it using StyleSheet and you cannot setup it using TextFormat. It’s not as imortant when you have Static Text cause then you can simply draw line on top of it. But it becomes important when you have Dynamic or Input Text. I will explain workaround on choosen scenario where we want to undescore all links (<a> tags) with blue dotted line inside of Dynamic Text Field. (more…)

Powered by WordPress