flash actionscript:
I have a script that will bring in my resume and scroll it beautifully - the only problem is that the text is extremely small and hard to read. If you could alter this text in a way that will let me apply font, style, size, and color to the imported text, and then display it that way as it scrolls, I would be most grateful. Telling me to use such and such a function doesn't work at my level of understanding - I need to see it in the code for me to be able to get it to work. Thanks, jcarruth var external_txt:TextField = new TextField(); var externalReq:URLRequest = new URLRequest("resume.txt"); var externalLoad:URLLoader = new URLLoader(); externalLoad.load(externalReq); externalLoad.addEventListener(Event.COMPLETE, textReady); external_txt.x = 9; external_txt.y = 5; external_txt.border = true; external_txt.width = 480; external_txt.height = 345; external_txt.wordWrap = true; addChild(external_txt); function textReady(event:Event):void { external_txt.text = event.target.data; } var dir:int var t:Timer=new Timer(50,0); t.addEventListener(TimerEvent.TIMER,scrollF,false,0,true); up_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollUp); down_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollDown); up_btn.addEventListener(MouseEvent.CLICK, stopScrollF,false,0,true); down_btn.addEventListener(MouseEvent.CLICK, stopScrollF,false,0,true); function scrollUp(event:MouseEvent):void { dir = -1; t.start(); } function scrollDown(event:MouseEvent):void { dir = 1; t.start(); } function stopScrollF(evt:MouseEvent){ t.stop(); } function scrollF(evt:TimerEvent){ external_txt.scrollV += dir; }
var format:TextFormat = new TextFormat(); format.font = "Arial"; format.color = 0xFFFFFF; format.size = 14; external_txt.defaultTextFormat = format; hope this of some help
Zibber, Thanks for your answer. Do I just stick your code as is on top, above my first line?
I put the code in the top above my first line and it generated errors and did not work. I put the code after textReady); and it created a blank screen. Any ideas on how (or where) to implement this code? Thanks, jcarruth
what erros di u get. I cant see it would hurt to place the actual format paramters(the first four lines) above your external_text declarations. Whilst palcing the 5th line just above your addingof external_text to display list
[q][i]Originally posted by: [b][b]zibber[/b][/b][/i] what erros di u get. I cant see it would hurt to place the actual format paramters(the first four lines) above your external_text declarations. Whilst palcing the 5th line just above your addingof external_text to display list[/q] I either get a blank screen, or no change to the text being displayed. Here's where I put the first four lines of your code: I can't seem to get the location of where to put the "external_txt.defaultTextFormat = format;" line. Could you give me the full line of code, and then tell me if it goes before or after that line? I tried "Whilst palcing the 5th line just above your addingof external_text to display list" and it was not specific enough for me, obviously. Here's the code with your 4 lines added. So far, the text appears and scrolls, but no formatting happens. Thanks, jcarruth var format:TextFormat = new TextFormat(); format.font = "Arial"; format.color = 0xFFFFFF; format.size = 14; var external_txt:TextField = new TextField(); var externalReq:URLRequest = new URLRequest("resume.txt"); var externalLoad:URLLoader = new URLLoader(); externalLoad.load(externalReq); externalLoad.addEventListener(Event.COMPLETE, textReady); external_txt.x = 9; external_txt.y = 5; external_txt.border = true; external_txt.width = 480; external_txt.height = 345; external_txt.wordWrap = true; addChild(external_txt); function textReady(event:Event):void { external_txt.text = event.target.data; } var dir:int var t:Timer=new Timer(50,0); t.addEventListener(TimerEvent.TIMER,scrollF,false,0,true); up_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollUp); down_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollDown); up_btn.addEventListener(MouseEvent.CLICK, stopScrollF,false,0,true); down_btn.addEventListener(MouseEvent.CLICK, stopScrollF,false,0,true); function scrollUp(event:MouseEvent):void { dir = -1; t.start(); } function scrollDown(event:MouseEvent):void { dir = 1; t.start(); } function stopScrollF(evt:MouseEvent){ t.stop(); } function scrollF(evt:TimerEvent){ external_txt.scrollV += dir; }
Don't see what you're looking for? Try a search.
|