TwelvestoneFlash

AS3, htmlText, linked images, aliasing


Sign in

  • Waiting for Godot ( 720 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 4.8 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.8 k posts )
    general front end design an...
  • Back End ( 9.6 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
baron ruhstoff
 
2007-10-01

I have a textfield set at an angle in which all linked images look like crap - jaggies abound. Is there anything that can be done, or should I resign myself to keeping it perfectly horizontal?

pyrogen
 
2007-10-01

set your bitmaps to smooth.

if you images are dynamic, set smoothing to the bitmapObject before adding to you sprite.

coo

baron ruhstoff
 
2007-10-01

Thing is, the images are included via the img tag within the htmlText-enabled dynamic textfield, so I'm not sure that there is even a bitmap to manipulate.

I haven't played around much with bitmaps yet, so it's entirely possible that I'm missing something...

// edit: Came across the following here:

You can load SWF files and bitmaps into a text field by using the tag, as in the following code:

You can access content loaded this way by using the getImageReference() method of the TextField instance, as in the following code:

var loadedObject: DisplayObject = myTextField.getImageReference('instanceName');

...When you use an tag in a text field to load an external file (as opposed to using a Bitmap class embedded within your SWF), a Loader object is automatically created as a child of the TextField object, and the external file is loaded into that Loader just as if you had used a Loader object in ActionScript to load the file. In this case, the getImageReference() method returns the Loader that was automatically created. No security check is needed to access this Loader object because it is in the same security sandbox as the calling code.

Long story short, it's possible to access individual bitmaps loaded via img as long as the id attribute is set.

In my case, however, there is no id attr so I'm assuming that those bitmaps are out of reach. Is there some sort of global setting that can be applied?

drystan
 
2009-01-29

Just a note to say that it is possible to set the smoothing property of images by using getImageReference(), but there is a gotcha to look out for.

getImageReference() returns a loader object, and the image gets added as a child of the loader object. However, the loader has to load the image before it can add it as a child, so initially there is no Bitmap to apply smoothing to.

You have to add a listener to the loader, and once the loader has dispatched its Event.COMPLETE event, you can then set the smoothing property of the child Bitmap of the loader.

var loader:Loader = textfield.getImageReference("image") loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onHtmlImageLoaded);

private function onHtmlImageLoaded(event:Event):void { event.target.removeEventListener(Event.COMPLETE, onHtmlImageLoaded); Bitmap(event.target.content).smoothing = true;
}

Hopefully this might be useful to someone.

baron ruhstoff
 
2009-01-30

Well hey! Forgot about this one...

You hit the nail on the head. One thing you left out, however, is that the string passed to getImageReference comes from the id of the image tag.

As it turns out I was playing around with this very thing last week. I wasn't happy with the positioning of the image in a bunch of text and gave it a bit of rotation. This, of course, changed the height and width of the bounding box and made the text wrap look sketchy. Given that in this particular case the height and width attributes were not going to be included, I could not pull the bitmap out of the textfield lest I risk losing the wrapping.

What I ended up doing was this: copy the bitmap, set the original's visibility to false, and set the copy in [roughly] the same position with the rotation... scaling down the size to minimize overlap with the text.

Long story short: manipulating inline images while maintaining reasonably good-looking text-wrapping.

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFlash

AS3, htmlText, linked images, aliasing