567 posts
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 5
  • Collector Level 2
+5 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

8586 posts Community Moderator
  • United Kingdom
  • 7 Years of Membership
  • Moderator
  • Winner
+10 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
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 5
  • Collector Level 2
+5 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

5467 posts The Dude Abides
  • Top Monthly Author
  • Trendsetter
  • Weekly Top Seller
  • United States
+13 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
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 5
  • Collector Level 2
+5 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.

736 posts fifty_tons and CodingJack
  • Elite Author
  • Author Level 7
  • Weekly Top Seller
  • Top Monthly Author
+6 more
ant_farm
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
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 5
  • Collector Level 2
+5 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

2486 posts Premium Scripts, Plugins and Themes
  • 8 Years of Membership
  • Affiliate Level 5
  • Author Level 8
  • Beta Tester
+9 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 :)

621 posts Don't be so humble - you are not that great.
  • Affiliate Level 3
  • Author Level 7
  • Collector Level 2
  • Copyright Ninja
+7 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