PDA

View Full Version : Weird problem: some text not showing on some Macs.



daidai
August 24th, 2008, 08:41 AM
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:
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);
}
}
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;
}
}
}
has anyone come across a similar problem? any ideas?

sekasi
August 24th, 2008, 06:17 PM
Hahaha I think you've run into "my" bug ;)

I've helped three people get over this one, if it works I'll have a laugh.

try this on the textfields that aren't showing up, after you add the text;

textfield.x += 1; textfield.x -= 1;

I know, sounds ridiculous right? Try it ;)

Pier25
August 25th, 2008, 05:35 AM
One of the few things that I hate about my mac is how badly flash runs...

Also if you're on firefox never put wmode = transparent (win & mac).

daidai
August 25th, 2008, 11:29 AM
:puzzle:
thanks for the help, but it hasnt worked, hmmm i wouldnt have guessed macs render text any differently. i thought the flash player was the same over all platforms. anything else you can suggest?
:puzzle:

sekasi
August 25th, 2008, 06:26 PM
aw. Did you do it after the addchild ?

Anogar
August 25th, 2008, 09:00 PM
If that doesn't work, try this:



myText.x = int(myText.x);


I've hit this bug before, it's an error in the OS X player, and Sekasi's solution worked for some of the fields - but for other fields I had to make sure it was an integer.

And do make sure that you do all this after the addChild().

daidai
August 26th, 2008, 08:17 PM
thanks for your help both, but I cant get the links to display...I tried every combination.
what is the bug exactly? is it anything to do with the for loop? why has this bug not happened before, it has been working fine for months :crying:

daidai
August 27th, 2008, 04:07 PM
anyone any ideas this is driving me nuts, this is the last problem before it goes live?
I'm contemplating totally redesigning the page, but even then I dont know if the problem will occurr, as Ive no idea what the problem is :crying::crying:

Pier25
August 28th, 2008, 06:06 AM
maybe this helps...

http://forums.macrumors.com/showthread.php?t=376073

it's so frustrating when you don't even know where to start...

daidai
August 28th, 2008, 06:35 AM
Thanks Pier25, I had found this article aswell while on a search mission, but it really only suggests that they download the latest version of the Player, which isnt really a solution as I cant ask all Mac users to make sure they have the latest version just to view the site...I guess I'll have to just redesign the page :( I wouldnt mind if I knew what I had done to create the problem, it was working fine a couple of versions ago, and the code in question hasnt been changed :puzzle: :puzzle: :puzzle: :puzzle: :puzzle: :puzzle:

Pier25
August 28th, 2008, 06:59 AM
Hey don't panic man :)

You can always do a flash player express install and upgrade the player from within the flash using the detection kit provided by adobe

http://www.adobe.com/devnet/flashplayer/articles/express_install.html

http://www.adobe.com/products/flashplayer/download/detection_kit/

daidai
August 28th, 2008, 07:08 AM
Hey don't panic man :)
I know :smirk: normally this wouldnt stress me, but its the last problem of a 6 month long project.


You can always do a flash player express install and upgrade the player from within the flash using the detection kit provided by adobe

http://www.adobe.com/devnet/flashplayer/articles/express_install.html

http://www.adobe.com/products/flashplayer/download/detection_kit/
This is clever, but Im not 100% about it being the complete solution: what if they say no to the install? I will download the latest player on my friends Mac and see if that solves the problem.
Thanks for your suggestions Pier25

daidai
August 28th, 2008, 07:19 PM
pants...viewing it on the latest viewer doesnt help.
right I'm going to redo the page, only I have no idea what I did wrong last time, especially as it worked for ages :puzzled: anyone any info on why this problem occurs? is it just to do with TextField.x and nothing else? why does it only happen in this one class?

edit: I got around the problem by creating the text fields individually not in a loop. Don't know why, but it worked.