Tennessee_Cowgirl
New Member
I'm new to AS3, and last touched Flash when it was with Macromedia, version 4.I'm building a flashapp to display images via html data.The data is populated in a \[code\]TextArea\[/code\] object via \[code\]htmlText\[/code\] property.The \[code\]TextArea\[/code\] container has a fixed width and height;In the html data, I have multiple \[code\]<img>\[/code\] tags referencing external images.However, the problem arise when the image referenced is larger than the \[code\]TextArea\[/code\] dimensions.\[code\]import fl.controls.TextArea;var box:*;box = TextArea();box.htmlText = "External HTML Data with multiple <img src='http://stackoverflow.com/questions/12735041/elsewhere.jpg'> tags"\[/code\]The images within the external data does not have any \[code\]id\[/code\] attributes in it. I've tried css styling with the styleSheet property, but flash only supports a subset of CSS1 specs.http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/StyleSheet.htmlSo css \[code\]max-width\[/code\] is nowhere to be found.The closest possible solution I've read about, uses \[code\]getImageReference\[/code\] methodhttp://help.adobe.com/en_US/FlashPl...flash/text/TextField.html#getImageReference()from TextField object.This method requires the image in the image to be first loaded, then be called by \[code\]getImageReference\[/code\] via \[code\]id\[/code\] attribute to get a \[code\]DisplayObject\[/code\] which then can be manipulated.From here, it seems that I would need to get a \[code\]string.match\[/code\] method on the external data to match and insert different \[code\]id\[/code\] attribute for each \[code\]<img>\[/code\] tag. Then, after loading, has to be looped through to manually calculate each of the image size, then set their scaling properties to keep aspect ratio.This solution seems complicated, and it might not actually work.I would like to ask if anyone has a better simpler solution that I might have missed while digging through the documentation.All help is appreciated. Thanks in advance.