I have bit of a strange problem. In have a MovieClip i resize, but the vector graphic doesn't resize with it. It's a Movieclip in my library that i'm linking to and when I insert it on my stage, it resizes just fine.
I have exported the MovieClip as an AS Object called: TabTemplate
and the i extend it in a class called Tab
.
I set some text in the textfield defined in it and the resize the tab accordingly. but the graphic doesnt follow :(
I'm not used to AS3's ways of doing things, so there might be something i've missed.
Here's the class code:
package mypackage {
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
public class Tab extends TabTemplate {
function Tab() {
}
/*** Getters/Setters ***/
public function set text( value:String ):void {
this.tabname.wordWrap = false;
this.tabname.autoSize = TextFieldAutoSize.LEFT;
this.tabname.text = value;
this.tabname.y = (this.mcMask.height - this.tabname.textHeight) /2;
this.tabname.x = this.tabname.y;
this.width = this.tabname.width + (this.tabname.x *2);
// I want to avoide to resize this after resizing the MovieClip
//this.mcMask.width = this.width;
}
public function get text():String {
return this.tabname.text;
}
}
}
There is actually two issues going on here:
1) The textWidth
isn't return the correct number. I have some shadow on the text and i don't know if that screws anything up. But otherwise I'm just using Regular Arial.
2) The mask of the 'Tab' + it's vector background isn't resizing when I'm resizing the MovieClip, like it does in Flash it self.
textWidth
, but it just returns the same number, so that didn't help unfortunately. @heartcodes: your suggestion might work, but it's the thing i wanted to avoid. – TokimonTabTemplate
from the library, there is nothing more to it actually. I then just extend it with theTab
class. So basically it should just be a MovieClip with predefined content i extend. – Tokimon