567 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+4 more
iamdok says

Hey Guys,

I’m looking for a way to prevent text from flowing around images in a htmlTextfield inserted using “img” tags.

The catch is that I do not have access to the html (i’m loading it from the web), so a solution will need to take this into account. If I had access to the html I could set the “hspace” attribute of the “img” tags.

I’m trying to do it with css, but flash has very limited css tag support. The margin property or the text-align is not doing much for me.

Also images can obviously vary in width, but the max width of the Flash textfield is 500px.

AS3 btw.

Any Ideas?

Donagh

8291 posts Community Moderator
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Attended one of our Meetups around the world
+9 more
MSFX Moderator says
I’m looking for a way to prevent text from flowing around images in a htmlTextfield inserted using “img” tags.

so what are you instead trying to do with the images?

you could search the text, rip out the urls and then load them separately so you have full control. You could then have:

text

image

text

image

text

assuming you split the text where there was an image tag rather than just stripping the tag out…

567 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+4 more
iamdok says

Hey Matt,

Thanks, Yes, I was hoping to avoid going to such lengths! :D

If nothing better comes up, I’ll bite the bullet and use that method.

Donagh

5389 posts The Dude Abides
  • Located in United States
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has been part of the Envato Community for over 5 years
+9 more
CodingJack says

This will add a break after every image tag in a String:

http://pastie.org/968849

usage:

var str:String = 'This is some text <img src="image.jpg" /> This is some more text <img src="image.jpg" /> This is some more text';
str = FixImages.fix(str);

trace(str);

traces:

This is some text <img src="image.jpg" /><br /> This is some more text <img src="image.jpg" /><br /> This is some more text
567 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+4 more
iamdok says

Hi CJ,

Thanks man, the class works like a charm, but unfortunatley an extra “br” tag after each image doesn’t solve my problem, the text still flows like a mofo!

btw, what your usage licence on that class of yours? Shall I place it in com.crackerjack and use it on future project? A few words of blessing from the author to place in a txt file in the folder or file header?

Thanks again for your help.

Donagh.

734 posts fifty_tons and CodingJack
  • Has referred 1+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 1+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+5 more
50andJACK says

^ Yeah I see. Sorry man. I don’t know why I thought that would work. I think MSFX ’s suggestion is the only solution. Maybe the new CS5 TLF API would work if you can target FP10 .

Feel free to use that code anyway you want :)

-Jack

567 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+4 more
iamdok says

Cheers CJ,

After spending too many hours on it, I’m abandoning ship. Its becomming too complex and long winded, and I’m on the clock!

I’m loading about 50 bodies of html text. stripping out the img paths is not a problem, but trying to find if each image has a “href” applied to it is more tricky, not to mention splitting the body of text in a good place making sure none of the img tag’s attribute or any of the anchor tag’s attributes (if present) are left behind or split, hence breaking the html structure. Any one of these 50 bodies of html text can have many img tags and many anchor tags, either associated with the images or not. So providing for all possibilities is becoming very difficult.

All this even before I start loading the list of images, positioning the new multiple textfields and only then getting the height of the overall container! phew. That is a hell of a lot of trouble just to deal with loaded html! Flash shouldn’t make it this difficult. I couldn’t be that hard for Adobe to add additional support for css and html tags.

Dang!

Anyway, thanks for your input. Donagh

2485 posts Premium Scripts, Plugins and Themes
  • Has been part of the Envato Community for over 7 years
  • Has referred 200+ members
  • Has sold $125,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+6 more
LucidStudios says
I’m looking for a way to prevent text from flowing around images in a htmlTextfield inserted using “img” tags.

so what are you instead trying to do with the images?

you could search the text, rip out the urls and then load them separately so you have full control. You could then have:

text

image

text

image

text

assuming you split the text where there was an image tag rather than just stripping the tag out…

that’s what I did recently when I developed a custom CMS in flex for a full flash website :)

608 posts Don't be so humble - you are not that great.
  • Has referred 10+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+4 more
plusquare says

That’s a tough one, I think flash CS5 now brings a feature that woul probably help you. Didn’t try it yet but it seems to be handy in this sort of things. Go have a look :p

by
by
by
by
by
by