Re: [Flashcoders] Matrix Transformation Problem
On Thu, Feb 18, 2010 at 2:15 PM, Keith Reinfeld keithreinf...@comcast.netwrote: I did all of the above copying and pasting your code on a black stage... You pasted it on the stage? No. Created DesertSands.as and called it from Properties::Class. Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Matrix Transformation Problem
On Wed, Feb 17, 2010 at 3:29 PM, Keith Reinfeld keithreinf...@comcast.netwrote: Susan, Try this in a fresh fla. Be sure to import Arial Black font into the library and give it a classname of 'ArialBlack.' If there is still a problem, please be specific. I did all of the above copying and pasting your code on a black stage color (white font, no?) and nothing printed to screen. No errors. Wish I could give you more feedback. CS4. TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Matrix Transformation Problem
I did all of the above copying and pasting your code on a black stage... You pasted it on the stage? Paste the code into a new ActionScript file, save the file as 'DesertSands.as' in the same folder as the new fla. Now you can either import DesertDSands.as, In the fla Actions Panel: import DesertSands; var ds:DesertSands = new DesertSands(); addChild(ds); or Set DesertSands.as as the fla's Document Class. In the fla Properties Panel Class field type: DesertSands HTH Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Matrix Transformation Problem
On Wed, Feb 17, 2010 at 11:05 AM, Cor c...@chello.nl wrote: And also missing : SpinningWorld; Navigation; Spotlight; To make matters easier, I eliminated the above: package { import flash.geom.Transform; import flash.filters.DropShadowFilter; import flash.text.TextField; import flash.text.TextFormat; import flash.text.TextFormatAlign; import flash.text.TextFieldAutoSize; import flash.geom.Matrix; import flash.events.IOErrorEvent; import flash.filters.GlowFilter; import flash.display.Sprite; import flash.events.Event; import flash.events.ProgressEvent; import flash.events.Event; import flash.events.MouseEvent; import flash.display.MovieClip; import flash.display.Loader; import flash.display.LoaderInfo; import flash.display.DisplayObject; import flash.net.URLRequest; import flash.display.Shape; import flash.geom.*; import flash.display.Bitmap; import flash.display.BitmapData; import flash.filters.GlowFilter; import flash.filters.BitmapFilterQuality; import flash.geom.Rectangle; import com.greensock.*; import com.greensock.easing.*; // import SpinningWorld; // import Navigation; // import Spotlight; import flash.text.Font; public class DesertSands extends MovieClip { var myFont:Font = new ArialBlack(); // public var myNav:Navigation; // public var mySpinningWorld:SpinningWorld; // public var mySpotlight:Spotlight; public var radius:int = 500; public var textureMap:BitmapData; public var myLogo:Bitmap; var parent_container:Sprite = new Sprite(); var fontContainer:MovieClip = new MovieClip(); var target:MovieClip = new MovieClip(); public function DesertSands() { // myNav = new Navigation(); // addChild(myNav); loadImage(); companyName(); slogan(); byline(); phoneNumbers(); } function companyName():void { var coName:TextField = new TextField(); coName.text = 'Desert Sands Industrial'; coName.textColor = 0xFF; coName.autoSize = TextFieldAutoSize.LEFT; coName.x = 550; coName.y = 55; coName.embedFonts = true; var format:TextFormat = new TextFormat(); format.font = myFont.fontName; format.size = 40; coName.setTextFormat(format); var dropShadow:DropShadowFilter = new DropShadowFilter(); dropShadow.color = 0x00; dropShadow.blurX = 10; dropShadow.blurY = 10; dropShadow.angle = 0; dropShadow.alpha = 0.5; dropShadow.distance = 10; var filtersArray:Array = new Array(dropShadow); coName.filters = filtersArray; target.addChild(fontContainer); fontContainer.addChild(coName); addChild(fontContainer); var degX:Number = 15; var degY:Number = 15; var m:Matrix = transform.matrix; m.b = Math.tan(degY *(Math.PI/180)); m.c = Math.tan(degX *(Math.PI/180)); var t:Transform = new Transform(target); t.matrix = m; target.transform = t; TweenLite.to(target, 1, {x:-300}); } function slogan():void { var mySlogan:TextField = new TextField(); mySlogan.text = 'Innovative Solutions For All Your Business Needs'; mySlogan.textColor = 0x00; mySlogan.autoSize = TextFieldAutoSize.LEFT; mySlogan.x = 290; mySlogan.y = 100; var format:TextFormat = new TextFormat(); format.font = Arial Black; format.size = 15; mySlogan.setTextFormat(format); addChild(mySlogan); } function byline():void { var myByline:TextField = new TextField(); myByline.text = 'A Dyer and Payne Company'; myByline.textColor = 0x33; myByline.autoSize = TextFieldAutoSize.LEFT; myByline.x = 400; myByline.y = 120; var format:TextFormat = new TextFormat(); format.font = Arial; format.size = 15; myByline.setTextFormat(format); var italicFormat:TextFormat = new TextFormat(); italicFormat.italic = true; myByline.setTextFormat(italicFormat); addChild(myByline); } function phoneNumbers():void { var myPhoneNumbers0:TextField = new TextField(); myPhoneNumbers0.text = 'TollFree:'; myPhoneNumbers0.textColor = 0x00; myPhoneNumbers0.autoSize = TextFieldAutoSize.LEFT; myPhoneNumbers0.x = 770; myPhoneNumbers0.y = 50; var format0:TextFormat = new TextFormat(); format0.font = Arial Black; format0.size = 15; myPhoneNumbers0.setTextFormat(format0); addChild(myPhoneNumbers0); var myPhoneNumbers1:TextField = new TextField(); myPhoneNumbers1.text = '(866) 782-7649'; myPhoneNumbers1.textColor = 0x00; myPhoneNumbers1.autoSize = TextFieldAutoSize.LEFT; myPhoneNumbers1.x = 850; myPhoneNumbers1.y = 50; myPhoneNumbers1.setTextFormat(format0); addChild(myPhoneNumbers1); var myPhoneNumbers2:TextField = new TextField(); myPhoneNumbers2.text = 'Dalton:'; myPhoneNumbers2.textColor = 0x00; myPhoneNumbers2.autoSize = TextFieldAutoSize.LEFT; myPhoneNumbers2.x = 770; myPhoneNumbers2.y = 70; var format:TextFormat = new TextFormat(); format.font = Arial; format.size = 15; myPhoneNumbers2.setTextFormat(format); addChild(myPhoneNumbers2); var myPhoneNumbers3:TextField = new TextField(); myPhoneNumbers3.text = '(706) 259-4784'; myPhoneNumbers3.textColor = 0x00; myPhoneNumbers3.autoSize = TextFieldAutoSize.LEFT; myPhoneNumbers3.x = 850; myPhoneNumbers3.y = 70; myPhoneNumbers3.setTextFormat(format); addChild(myPhoneNumbers3);
RE: [Flashcoders] Matrix Transformation Problem
The problem with eliminating the aforementioned line is that the text is then not added to the screen at all. The addition of the other line made no noticeable difference. Please advise. coName.embedFonts = true; format.font = myFont.fontName; You need to embed the font any time you mess with the orientation of text. It's a long standing Flash foible. //Your recommended line to eliminate here: // addChild(fontContainer); Okay, it seems you are missing 'addChild(target);' In your original code you are adding 'fontContainer' as a child of 'target' then adding 'coName' as a child of 'fontContainer.' But when you do 'addChild(fontContainer)' you are moving 'fontContainer' back out of 'target,' which is why it becomes visible. However, you are still applying your transform to 'target' which not only no longer has 'fontContainer' as a child (along with its child 'coName') but has not, itself, been added to the display list. Your original post said that certain vars were defined outside the function. I guess I assumed that 'addChild(target)' fell into that category. My bad. Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Susan Day Sent: Wednesday, February 17, 2010 6:39 AM To: Flash Coders List Subject: Re: [Flashcoders] Matrix Transformation Problem I tried the two edits you recommended but without satisfactory result. Here's the new code: function companyName():void { var coName:TextField = new TextField(); coName.text = 'Company Name'; coName.textColor = 0xFF; coName.autoSize = TextFieldAutoSize.LEFT; coName.x = 550; coName.y = 55; // Your new line here: coName.embedFonts = true; var format:TextFormat = new TextFormat(); format.font = myFont.fontName; format.size = 40; coName.setTextFormat(format); var dropShadow:DropShadowFilter = new DropShadowFilter(); dropShadow.color = 0x00; dropShadow.blurX = 10; dropShadow.blurY = 10; dropShadow.angle = 0; dropShadow.alpha = 0.5; dropShadow.distance = 10; var filtersArray:Array = new Array(dropShadow); coName.filters = filtersArray; target.addChild(fontContainer); fontContainer.addChild(coName); //Your recommended line to eliminate here: // addChild(fontContainer); var degX:Number = 15; var degY:Number = 15; var m:Matrix = transform.matrix; m.b = Math.tan(degY *(Math.PI/180)); m.c = Math.tan(degX *(Math.PI/180)); var t:Transform = new Transform(target); t.matrix = m; target.transform = t; TweenLite.to(target, 1, {x:-300}); } The problem with eliminating the aforementioned line is that the text is then not added to the screen at all. The addition of the other line made no noticeable difference. Please advise. TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2692 - Release Date: 02/16/10 13:35:00 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Matrix Transformation Problem
Your transformation code may be a little too funky :) I (drastically) simplified your code and it works fine: private function companyName():void { var coName:TextField = new TextField(); with(coName){ x = 100; y = 100; autoSize = TextFieldAutoSize.LEFT; embedFonts = true; defaultTextFormat = new TextFormat(Arial, 40, 0); text = Company Name; filters = [new DropShadowFilter(10, 0, 0, 0.5, 10, 10)]; } addChild(coName); //transform var degX:Number = 15; var degY:Number = 15; var m:Matrix = new Matrix(); m.b = Math.tan(degY*Math.PI/180); m.c = Math.tan(degX*Math.PI/180); coName.transform.matrix = m; } -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 15 February 2010 16:44, Susan Day suzieprogram...@gmail.com wrote: Hello; I'm trying to get a matrix transformation to work. The thing about my code is that it prints to screen just fine without any exceptions...but it doesn't skew the text as I'd like it to. Here's my function. All variables defined earlier in code (again, everything works except the transform): function companyName():void { var coName:TextField = new TextField(); coName.text = 'Company Name'; coName.textColor = 0xFF; coName.autoSize = TextFieldAutoSize.LEFT; coName.x = 550; coName.y = 55; var format:TextFormat = new TextFormat(); format.font = myFont.fontName; format.size = 40; coName.setTextFormat(format); var dropShadow:DropShadowFilter = new DropShadowFilter(); dropShadow.color = 0x00; dropShadow.blurX = 10; dropShadow.blurY = 10; dropShadow.angle = 0; dropShadow.alpha = 0.5; dropShadow.distance = 10; var filtersArray:Array = new Array(dropShadow); coName.filters = filtersArray; target.addChild(fontContainer); fontContainer.addChild(coName); addChild(fontContainer); var degX:Number = 15; var degY:Number = 15; var m:Matrix = transform.matrix; m.b = Math.tan(degY *(Math.PI/180)); m.c = Math.tan(degX *(Math.PI/180)); var t:Transform = new Transform(target); t.matrix = m; target.transform = t; } TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Matrix Transformation Problem
On Wed, Feb 17, 2010 at 11:47 AM, kennethkawam...@gmail.com kennethkawam...@gmail.com wrote: Your transformation code may be a little too funky :) I (drastically) simplified your code and it works fine: private function companyName():void { var coName:TextField = new TextField(); with(coName){ x = 100; y = 100; autoSize = TextFieldAutoSize.LEFT; embedFonts = true; defaultTextFormat = new TextFormat(Arial, 40, 0); text = Company Name; filters = [new DropShadowFilter(10, 0, 0, 0.5, 10, 10)]; } addChild(coName); //transform var degX:Number = 15; var degY:Number = 15; var m:Matrix = new Matrix(); m.b = Math.tan(degY*Math.PI/180); m.c = Math.tan(degX*Math.PI/180); coName.transform.matrix = m; } Kenneth, this didn't work for me. However, Cor's recommendation he just emailed me did. Nonetheless, I'm curious about your simplification because I'd like to get that simplified code working. Here's what I built that didn't work. I think you can safely disregard all the extra import statements. I've stripped down my code considerably to the necessary only: package { import flash.geom.Transform; import flash.filters.DropShadowFilter; import flash.text.TextField; import flash.text.TextFormat; import flash.text.TextFormatAlign; import flash.text.TextFieldAutoSize; import flash.geom.Matrix; import flash.events.IOErrorEvent; import flash.filters.GlowFilter; import flash.display.Sprite; import flash.events.Event; import flash.events.ProgressEvent; import flash.events.Event; import flash.events.MouseEvent; import flash.display.MovieClip; import flash.display.Loader; import flash.display.LoaderInfo; import flash.display.DisplayObject; import flash.net.URLRequest; import flash.display.Shape; import flash.geom.*; import flash.display.Bitmap; import flash.display.BitmapData; import flash.filters.GlowFilter; import flash.filters.BitmapFilterQuality; import flash.geom.Rectangle; import com.greensock.*; import com.greensock.easing.*; import flash.text.Font; public class DesertSands extends MovieClip { public function DesertSands():void { var coName:TextField = new TextField(); with(coName){ x = 100; y = 100; autoSize = TextFieldAutoSize.LEFT; embedFonts = true; defaultTextFormat = new TextFormat(Arial, 40, 0); text = Company Name; filters = [new DropShadowFilter(10, 0, 0, 0.5, 10, 10)]; } addChild(coName); /* var degX:Number = 15; var degY:Number = 15; var m:Matrix = new Matrix(); m.b = Math.tan(degY*Math.PI/180); m.c = Math.tan(degX*Math.PI/180); coName.transform.matrix = m; */ } } } TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Matrix Transformation Problem
I used Arial for the embedded font so you need to change that to your font name. Otherwise my example is very simple and should work :) -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 17 February 2010 16:23, Susan Day suzieprogram...@gmail.com wrote: On Wed, Feb 17, 2010 at 11:47 AM, kennethkawam...@gmail.com kennethkawam...@gmail.com wrote: Your transformation code may be a little too funky :) I (drastically) simplified your code and it works fine: private function companyName():void { var coName:TextField = new TextField(); with(coName){ x = 100; y = 100; autoSize = TextFieldAutoSize.LEFT; embedFonts = true; defaultTextFormat = new TextFormat(Arial, 40, 0); text = Company Name; filters = [new DropShadowFilter(10, 0, 0, 0.5, 10, 10)]; } addChild(coName); //transform var degX:Number = 15; var degY:Number = 15; var m:Matrix = new Matrix(); m.b = Math.tan(degY*Math.PI/180); m.c = Math.tan(degX*Math.PI/180); coName.transform.matrix = m; } Kenneth, this didn't work for me. However, Cor's recommendation he just emailed me did. Nonetheless, I'm curious about your simplification because I'd like to get that simplified code working. Here's what I built that didn't work. I think you can safely disregard all the extra import statements. I've stripped down my code considerably to the necessary only: package { import flash.geom.Transform; import flash.filters.DropShadowFilter; import flash.text.TextField; import flash.text.TextFormat; import flash.text.TextFormatAlign; import flash.text.TextFieldAutoSize; import flash.geom.Matrix; import flash.events.IOErrorEvent; import flash.filters.GlowFilter; import flash.display.Sprite; import flash.events.Event; import flash.events.ProgressEvent; import flash.events.Event; import flash.events.MouseEvent; import flash.display.MovieClip; import flash.display.Loader; import flash.display.LoaderInfo; import flash.display.DisplayObject; import flash.net.URLRequest; import flash.display.Shape; import flash.geom.*; import flash.display.Bitmap; import flash.display.BitmapData; import flash.filters.GlowFilter; import flash.filters.BitmapFilterQuality; import flash.geom.Rectangle; import com.greensock.*; import com.greensock.easing.*; import flash.text.Font; public class DesertSands extends MovieClip { public function DesertSands():void { var coName:TextField = new TextField(); with(coName){ x = 100; y = 100; autoSize = TextFieldAutoSize.LEFT; embedFonts = true; defaultTextFormat = new TextFormat(Arial, 40, 0); text = Company Name; filters = [new DropShadowFilter(10, 0, 0, 0.5, 10, 10)]; } addChild(coName); /* var degX:Number = 15; var degY:Number = 15; var m:Matrix = new Matrix(); m.b = Math.tan(degY*Math.PI/180); m.c = Math.tan(degX*Math.PI/180); coName.transform.matrix = m; */ } } } TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Matrix Transformation Problem
On Wed, Feb 17, 2010 at 12:40 PM, kennethkawam...@gmail.com kennethkawam...@gmail.com wrote: I used Arial for the embedded font so you need to change that to your font name. Otherwise my example is very simple and should work :) I did need to make that adjustment, but it still didn't work :( Thanks anyway ;) Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Matrix Transformation Problem
Susan, Try this in a fresh fla. Be sure to import Arial Black font into the library and give it a classname of 'ArialBlack.' If there is still a problem, please be specific. DesertSands.as (document class) package { import flash.display.MovieClip; import flash.filters.DropShadowFilter; import flash.text.TextField; import flash.text.TextFormat; import flash.text.TextFieldAutoSize; import flash.text.Font; import flash.geom.Matrix; public class DesertSands extends MovieClip { private var coName:TextField = new TextField(); private var coNameParent:MovieClip = new MovieClip(); private var arialBlack:Font = new ArialBlack(); public function DesertSands():void { // Set textfield properties coName.autoSize = TextFieldAutoSize.LEFT; coName.embedFonts = true; coName.defaultTextFormat = new TextFormat(arialBlack.fontName, 40, 0xFF); coName.text = Desert Sands Industrial; coName.filters = [new DropShadowFilter(10, 0, 0, 0.5, 10, 10)]; // Apply the transformation coName.transform.matrix = applyTransformation(15, 15); // Use coNameParent for positioning coNameParent.x = 10; coNameParent.y = 100; // Add assets to the display list coNameParent.addChild(coName); addChild(coNameParent); } private function applyTransformation(x:Number, y:Number):Matrix { var m:Matrix = new Matrix(); m.b = Math.tan(x * Math.PI / 180); m.c = Math.tan(y * Math.PI / 180); return m; } } } Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Matrix Transformation Problem
Remove the line 'addChild(fontContainer);' Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Susan Day Sent: Monday, February 15, 2010 10:45 AM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Matrix Transformation Problem Hello; I'm trying to get a matrix transformation to work. The thing about my code is that it prints to screen just fine without any exceptions...but it doesn't skew the text as I'd like it to. Here's my function. All variables defined earlier in code (again, everything works except the transform): function companyName():void { var coName:TextField = new TextField(); coName.text = 'Company Name'; coName.textColor = 0xFF; coName.autoSize = TextFieldAutoSize.LEFT; coName.x = 550; coName.y = 55; var format:TextFormat = new TextFormat(); format.font = myFont.fontName; format.size = 40; coName.setTextFormat(format); var dropShadow:DropShadowFilter = new DropShadowFilter(); dropShadow.color = 0x00; dropShadow.blurX = 10; dropShadow.blurY = 10; dropShadow.angle = 0; dropShadow.alpha = 0.5; dropShadow.distance = 10; var filtersArray:Array = new Array(dropShadow); coName.filters = filtersArray; target.addChild(fontContainer); fontContainer.addChild(coName); addChild(fontContainer); var degX:Number = 15; var degY:Number = 15; var m:Matrix = transform.matrix; m.b = Math.tan(degY *(Math.PI/180)); m.c = Math.tan(degX *(Math.PI/180)); var t:Transform = new Transform(target); t.matrix = m; target.transform = t; } TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2685 - Release Date: 02/15/10 01:35:00 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Matrix Transformation Problem
Sorry, you will also need 'coName.embedFonts = true;' Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Keith Reinfeld Sent: Monday, February 15, 2010 12:22 PM To: 'Flash Coders List' Subject: RE: [Flashcoders] Matrix Transformation Problem Remove the line 'addChild(fontContainer);' Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders