567 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Ireland
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
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

8190 posts Community Moderator
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 6-7 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX Volunteer 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
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Ireland
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
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

5311 posts The Dude Abides
  • United States
  • Exclusive Author
  • Has been a member for 5-6 years
  • Elite Author
  • Bought between 100 and 499 items
  • Referred between 100 and 199 users
  • Author had a Free File of the Month
+5 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
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Ireland
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
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.

732 posts fifty_tons and CodingJack
  • Elite Author
  • Sold between 50 000 and 100 000 dollars
  • Exclusive Author
  • Author had a Free File of the Month
  • United States
  • Referred between 1 and 9 users
  • Has been a member for 4-5 years
  • Bought between 1 and 9 items
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
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Ireland
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
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
  • Bought between 10 and 49 items
  • Elite Author
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 7-8 years
  • Interviewed on the Envato Notes blog
  • Referred between 200 and 499 users
+1 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 :)

580 posts Don't be so humble - you are not that great.
  • Elite Author
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Has been a member for 4-5 years
  • Bought between 10 and 49 items
  • Referred between 10 and 49 users
  • Portugal
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