The text created in the code below shows 99% of the time on both PCs and Macs, but sometimes it wont show on Macs. There seems to be not reason for it. I havent been messing with the code.
This creates the links:
[AS]private function createText () : void {
for each (var i:XML in vidXML.item) {
vidThumb = new VideoThumb(i.@name, i.@file);
vidThumb.y = newHeight;
newHeight = vidThumb.y + vidThumb.height;
vidThumb.addEventListener (‘LINK_CLICKED’, clicked);
linkHolder.addChild(vidThumb);
}
}[/AS]
[AS]package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.net.URLRequest;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.AntiAliasType;
import flash.text.TextFieldAutoSize;
import flash.geom.ColorTransform;
import caurina.transitions.Tweener;
public class VideoThumb extends Sprite {
private var vidFile:String;
private var vidName:String;
private var _vid:Sprite = new Sprite();
private var txtField:TextField = new TextField();
private var format:TextFormat = new TextFormat ();
private var linkClickEvent:MouseEvent = new MouseEvent ('LINK_CLICKED', false,false);
public function VideoThumb (vidName:String, vidFile:String) {
this.vidName = vidName;
this.vidFile = vidFile;
this.addEventListener(MouseEvent.MOUSE_OVER, over);
this.addEventListener(MouseEvent.MOUSE_OUT, out);
init();
}
private function init():void{
format.size = 14;
format.font = new Helevetica ().fontName;
format.color = 0x333333;
format.align = 'left';
_vid.buttonMode = true;
_vid.useHandCursor = true;
_vid.mouseChildren = false
_vid.addEventListener (MouseEvent.CLICK, down);
txtField.embedFonts = true;
txtField.defaultTextFormat = format;
txtField.antiAliasType = AntiAliasType.ADVANCED;
txtField.autoSize = TextFieldAutoSize.LEFT;
txtField.wordWrap = true;
txtField.multiline = true;
txtField.selectable = false;
txtField.text = vidName;
txtField.width = 400;
_vid.addChild(txtField);
addChild(_vid);
}
private function down(evt:Event){
dispatchEvent(linkClickEvent);
}
private function over(evt:MouseEvent){
Tweener.addTween (this, { time:0.5, alpha:0.5 } );
}
private function out(evt:MouseEvent){
Tweener.addTween (this, { time:0.5, alpha:1 } );
}
public function get fileID () : String {
return vidFile;
}
}
}[/AS]
has anyone come across a similar problem? any ideas?