Htmltext in flash actionscript3.0

hi
below is my simple code
import flash.text.TextField;
var labelText:String='<p>this is first text <img src="https://www.paypal.com/en_GB/i/btn/btn_buynowCC_LG.gif" id="paypal_button"> this is last text</p>';
var label:TextField = new TextField();
label.border=true;
label.multiline=true;
label.wordWrap=true;
label.width=800;
label.height=300;
addChild(label);
label.htmlText=labelText;
o/p
so my problem is  my image always goto new line... i's not coming in text line (indicate red arrow), so what i do? i want image and text one line...
help pls
thnx

again not a perfect way to do this, there is probably a better way with regex but its beyond me
will separate the string you have given into its parts
it doesn't remove leading spaces
and it doesn't work with < img only <img
var imgTag:String = "<img";
var endTag:String = "/>";
var str:String = "this is text <img src='image.png' /> this is test text <img src='image2.png' /> this is last text <img src='image3.png' /> end line"
var results:Array = [];
var currentIndex:int = 0;
while (currentIndex < str.length)
    var index:int = str.indexOf(imgTag, currentIndex);
    if (index == currentIndex)
        index = str.indexOf(endTag, currentIndex) + 2;
    if (index < 0)
        index = str.length;
    var term:String = str.substring(currentIndex, index);
    results.push(term);
    currentIndex = index;
trace(results);

Similar Messages

  • Relative Sizes on HTMLTEXT on FLASH

    Hi
    I have a problem suing relative sizes on a HTMLtext on FLash
    I create the the textArea i set the size and everything if I
    do it by
    actionscript everything works fine except when i setup the
    htmltext, the
    text disspears so I need to re-set the embeded font with:
    myTextFormat.font = Varfont;
    textBox.embedFonts = true;
    textBox.setTextFormat(myTextFormat);
    But using this lines I lose the previous size. that i
    assigned before when i
    created the textarea. And goes to a standard size... dont
    know why, i am
    using a different TextFormat.....
    And If i want to use the size i was using , all the text
    becomes the same
    size (but is the size that I want)...
    If I create the text area manually using the gui, it works
    well.
    ¬_¬
    >-------------------------------------------------------------------------------------<
    The main problem is... why the the text dissapears when i set
    a new html
    text???
    >-------------------------------------------------------------------------------------<
    Thanks.

    1. Really there are a few functions that i skiped yesterday:
    3. The font is linked and embeded in library.
    public function setHTMLText(texto:String):Void {
    textBox.html = true;
    textBox.htmlText = texto;
    public function setEmbedFont(__font) {
    _font = __font;
    _embed = true;
    setTextStyle(__font);
    public function setTextStyle(__font:String, __bold:Boolean,
    __underline:Boolean, __italic:Boolean) {
    var myTextFormat:TextFormat = new TextFormat();
    myTextFormat.font = _font;
    textBox.setTextFormat(myTextFormat);
    public function setTextSize(__size:Number) {
    var myTextSize:TextFormat = new TextFormat();
    myTextSize.size = _size;
    textBox.setTextFormat(myTextSize);
    Kind of constructor:
    autotext_txt.setTextSize(20);
    //1 if I activate this one the text will dissapear after
    asigning a new
    text. And I will need to apply the embed font again.
    autotext_txt.setEmbedFont("Arial2");
    autotext_txt.setHTMLText(This is a text (big text) | <font
    size="-5"
    color="#dddddd"> Small Text</font>');
    autotext_txt.setEmbedFont("Arial2");
    Why dont u have a try?
    Thanks,
    J
    "kglad" <[email protected]> escribió en
    el mensaje
    news:elo6bk$pu3$[email protected]..
    > 1. where's Varfont defined?
    > 2. htmtext should be htmlText.
    > 3. have you defined a linkage id for a library font?

  • Newbie Flash/actionScript3 question

    hi All,
    Apologies now as I am new to Flash, I have 'inherited' some flash files to incorporate into my java based web application.
    The first .swf file that I am using needs to use an xml file. I can get the .swf file to open with the data from the XML file if they are in the same directory of my webapp. The previous programmer has saved the xml file to disk, copied it over into the directory where the html files are in and then it all works. I don't want to save the xml file to disk, I would rather create the data for the xml file and send it as a parameter to the .swf file. I was thinking about doing this with FlashVars.
    I'll get to my problem now :-) FlashVars seem to be in name value pairs. I'm not sure what the parameter name of the XML file is in the .swf file.
    <param name="FlashVars" value="seq_list=images/seq_list.xml"/>     
    I have the source .fla file and I downloaded a demo copy of CS4 Flash professional and opened it up but I can't seem to find the actionScript. Flash files are written in actionScript right?
    But even if I could find the actionScript, I have an awful feeling that the .swf file simply looks for the seq_list.xml file in the current working directory, which is really not what I went. And as I can't find the actionScript I can't change the code.
    Anyway, sorry for the convoluted mail. As I said I am out of my depth big style with Flash and I would appreciate any comments (and it would help get my boss off my back too :-)
    Sandy

    You might find the actionscript in separate .as files.  Beyond that, in a more basic sense, if you are not familiar with how to find actionscript in the timeline of an AS3 file, you want to find keyframes in the timeline that have lower case "a"'s in them.  If you open the Actions window and select such a frame, the actionscript will appear in the window.

  • Saving HTMLText from flash

    I want to save HTMLText, read from a textfield, and save it. Problem I am facing is that the data comes with &lt; and &gt; instead of regular HTML < and > tags. Any idea how can I get the angled brackets instead of &lt; and &gt; ?

    how and where are you trying to save it?

  • Unable to create SWC in Flash CS4

    Hi,
    Im having trouble creating swc files, Ive tryed both by
    publishing and exporting individual movie clips from the library,
    no swc file is created. My work colleage is able to create them
    from the library but not by publishing, any ideas? Im using the
    Trial version which has not be updated to 10.0.0.1
    /Eric

    Ive tryed with just creating a single mv (a square) on the
    stage. I did the following:
    1) create a new Flash Actionscript3 project and saved it on
    the desktop
    2) Drew a square on the stage
    3) Converted it to a movieClip and clicked export to
    Actionscript
    4) went into publish settings, clicked export swc
    5) clicked on publish
    an swf file is created but no swc, it works at home and on my
    colleages computer but not on mine. Any clues?

  • Problem using relative sizes on a HTMLtext

    Hi
    I have a problem using relative sizes on a HTMLtext on Flash
    ActionsScript
    2.0
    Something like:
    htmltext= '<font size="+5">TITLE</font>Text
    Praragraph...'
    (+5 in normal HTML means is 5 points bigger than the standard
    text.)
    I create the the textArea i set the size and everything if I
    do it by
    actionscript everything works fine except when i setup the
    htmltext, the
    text disspears so I need to re-set the embeded font with:
    myTextFormat.font = Varfont;
    textBox.embedFonts = true;
    textBox.setTextFormat(myTextFormat);
    But using this lines I lose the previous size. that i
    assigned before when i
    created the textarea. And goes to a standard size... dont
    know why, i am
    using a different TextFormat.....
    And If i want to use the size i was using , all the text
    becomes the same
    size (but is the size that I want)...
    If I create the text area manually using the gui, it works
    well.
    ¬_¬
    >-------------------------------------------------------------------------------------<
    The main problem is... why the the text dissapears when i set
    a new html
    text???
    >-------------------------------------------------------------------------------------<
    Thanks.

    1. Really there are a few functions that i skiped yesterday:
    3. The font is linked and embeded in library.
    public function setHTMLText(texto:String):Void {
    textBox.html = true;
    textBox.htmlText = texto;
    public function setEmbedFont(__font) {
    _font = __font;
    _embed = true;
    setTextStyle(__font);
    public function setTextStyle(__font:String, __bold:Boolean,
    __underline:Boolean, __italic:Boolean) {
    var myTextFormat:TextFormat = new TextFormat();
    myTextFormat.font = _font;
    textBox.setTextFormat(myTextFormat);
    public function setTextSize(__size:Number) {
    var myTextSize:TextFormat = new TextFormat();
    myTextSize.size = _size;
    textBox.setTextFormat(myTextSize);
    Kind of constructor:
    autotext_txt.setTextSize(20);
    //1 if I activate this one the text will dissapear after
    asigning a new
    text. And I will need to apply the embed font again.
    autotext_txt.setEmbedFont("Arial2");
    autotext_txt.setHTMLText(This is a text (big text) | <font
    size="-5"
    color="#dddddd"> Small Text</font>');
    autotext_txt.setEmbedFont("Arial2");
    Why dont u have a try?
    Thanks,
    J
    "kglad" <[email protected]> escribió en
    el mensaje
    news:elo6bk$pu3$[email protected]..
    > 1. where's Varfont defined?
    > 2. htmtext should be htmlText.
    > 3. have you defined a linkage id for a library font?

  • Flash not what Adobe can do for you...

    [apologies to JF Kennedy and his speech writer]
    In a thread long ago in a forum not so far away, Eric Chan was overheard to say:
    "Once LR is updated to support the required ActionScript then Flash  galleries generated from LR will be color-managed as long as the user  has Flash Player 10 installed." (http://forums.adobe.com/message/1386909#1386909)
    Unless I've missed something, Adobe LR 3.3 still does not support Adobe Flash ActionScript3 (AS3 is the "required" one). Thus, as far as I've been able to tell, the Flash galleries from LR still give us garish, unmanaged color when using wide-gamut monitors. Yes I know, we don't have to use Flash galleries...
    To be fair to Eric, he did say: "Once LR is updated to support the required ActionScript..." He didn't promise when that would happen.
    He didn't even promise it would ever happen. For the record, his statement was made 30 months ago (LR 2.0 era, I believe).
    I don't mean to imply that Eric has any control over such matters.  I'm just using his post to set a milepost in this saga.
    The info window "About Adobe Photoshop Lightroom", gives you a button to press for the "credits" (i.e., LR's development personnel). Clearly a lot of people have worked on many aspects to develop and refine this application. One of the categories listed is "Flash Player Engineering".
    So who gets credit for that responsibility? I dunno. It's conspicuously blank.
    I'm just sayin'.
    Phil

    johnbeardy wrote:
    Yes, you have missed something.
    LR3 does indeed support ActionScript 3 and does support colour managed Flash movies.
    However, the default Flash gallery included in LR3 remains ActionScript 2 and not colour managed Flash.
    In other words, yes you can.
    John
    Thanks for setting me straight on that, John.  I came to what is evidently an erroneous surmise based on my "testing" with the current LR 3.3 default Flash (web) gallery. I guess I never expected that Adobe would update LR's Flash AS3 support yet not supply a version of the Flash gallery with AS3. To further befuddle my aging neurons, if there was some mention of the Flash "fix" in the listing of features and fixes that accompanied LR 3, I missed that although I recall searching for it.
    This past June (2010) I posted a lament that the lack of Flash color-management persisted in LR 3, but that got no reply of any kind. I wonder, was the support for AS3 actually introduced with 3.0, or later? Anyway, thanks again for the correction, and I extend apologies to Adobe (and Eric) for my rant.
    Now all I have to do is figure out how to take advantage of LR's support of Flash color management if LR's 3.3 default Flash web gallery ain't got it.

  • Can anyone contribute some inputs for creating flash website?

    Basically Iam new to flash actionscript3.0, I am plannning to create Flash website. I need some help from anyone like creating button events, getting url, loading dynamic text etc. If you can pls share useful source file which is helpful for me.
    Thanks,
    Habib

    As a relative newbie to Flash myself I'd simply recommend getting stuck in and messing about, find out how to do each individual thing as you come up against it. Don't be scared off by the new environment, if you just dive in you'll be up and running in no time Oh and don't expect the first thing you make to be of any real use - create something just to mess about in then start over once you know what you're doing a bit more.
    I found this collection of videos very helpful in getting up and running:
    http://tv.adobe.com/watch/learn-flash-professional-cs4/getting-started-01-understanding-fl ash/

  • Can't get URL to open in same window

    I am using Flash ActionScript3 - My banner has 3 images, each
    displays for ~5 seconds. I have each image linked to a web page
    with more info about each image. The problem is that I can't get
    the URLs to open in the same window! Each click opens another
    browser window. All attempts to resolve this using suggestions
    found in my googling for the answer results in error messages. Any
    help would be greatly appreciated!
    Here's my script for one of the images:

    In getURL you had a method parameter _self, look URLRequest
    definition in Flash help to see if it receives a similar parameter.
    _self is for link to open in same browser window, _blank is used
    for a new window.

  • How to save movieclip to pdf in AS3.0?

    Flash actionscript3.0
    How to save  movieclip to pdf ?
    Thanks in Advance.

    Thanks in Advance.
    one more question
    how to convert to flash file to avi file, with highquality.

  • How to dublicate the movieclip in as3.0

    Flash actionscript3.0
    How to dublicate the movieclip and attach the movieclip in stage.
    Thanks in Advance.

    Hi,
    You can do this in following way :-
    http://snipplr.com/view/12768/duplicatemovieclip-replacement/
    http://forums.adobe.com/message/2737929#2737929

  • Air not support img tag on textField?

    I try this:
    text_txt.htmlText = "<IMG src='myimage.jpg' id='image' /><P>This is my picture</P>";
    text_txt.text = text_txt.htmlText ;
    on Flash player
    out put is : <IMG src='myimage.jpg' id='image' /><P>This is my picture</P>;
    but on Air
    out put is : <P>This is my picture</P>;
    What's happened?
    Can you help me?
    and Sorry about my english.

    Hello,
    Any possibility you could use the HTML control instead?  The textField control does not support the <img> tag in AIR due to security issues.  Here's the comment from the documentation:
    For AIR content in the application security sandbox, AIR ignores img tags in HTML content in ActionScript TextField objects. This is to prevent possible phishing attacks.
    Thanks,
    Chris

  • Best Practices: Keyframes

    Hello all,
    I'd like to hear from some seasoned flash/actionscript3 developers and designers.
    In your expereince, what are the best practices when it comes to determining whether or not a frame should be made into a keyframe? Specifically,  I want to know how you decide to make keyframes or not to make keyframes in your projects and how this relates your use of actionscript 3.
    Thanks!

    In general, keyframes are useful any time you need to introduce a new something (instance, section, code segment, etc) or put an end to something (create a blank section in the timeline, or end the existence of something)..

  • How do you build an image gallery in Flash CS3 actionscript3?

    I am building my entire website in flash cs3, actionscript3
    but I really need help building an image gallery. What I need is a
    horizontal scroll bar that contains thumbs within it and then loads
    the full size image right above the scroll bar. Anyone has any
    suggestions for books, tutorials or even safe places to purchase
    the fla that I can customize it?

    if you want help understanding as3 check:
    http://www.senocular.com/flash/tutorials/as3withflashcs3/
    if you want to purchase a custom fla that does exactly what
    you want send me an email via my website.

  • Multilanguage and htmlText (Flash 8)

    Hi,
    In Flash 8, documentation speaks about multilanguage
    functionality with TextFields and it seems to work fine. But can we
    use the same functionality with HTML formatted TextFields?
    TextField.htmlText and TextField.text seem to be two distinct
    properties and the String Panel and XML loaded files seem to act
    only on the TextField.text property.
    Any answer?
    Jean

    Hello Adobe team. This is also interesting to our company.
    Please response to the question of log2e. Thanks a lot.
    Georgios

Maybe you are looking for

  • On Sun fire v490 - Solaris 10 with Oracle 8.1.7.4 & Sybase 12.0

    Hi, We are going to upgrade our server with this configuration - Sun Fire V490     2 x 1.05 GHz UltraSPARC IV CPU 8096MB RAM     2 x73GB local disk 2x FC 2GB Sun/QLogic HBAs DAT72 On one machine we will have Sun Solaris v10 with Oracle DB v8.1.7.4 &

  • HT1338 upgrade to mac os 10.7.5

    Hi, I am trying to update my Macbook pro software to Mac OS X 10.7.5. I did software update and it tells me that my mac is uptodate. The reason that I want to do this is because My iPhoto update from app store is not downloading because my mac is not

  • Read informations by mySql DB in AS3

    Hi, I have to develop an iOS application able to read "news" by an existent mySql DB on my customer's web site. Is there a way to do this in AS3? I didn't wrote that DB, but I've got these informations: Served Address; 33.222.1.000 DB: myDbName User

  • Changing default xmlparser in OC4J

    Hi to all, in the past few days I patched STXX (stxx.sourceforge.net) to work with BC4J (BC4JStruts) because we need to produce PDF document. I rebuild the oc4j.jar deleting form the manifest.mf the reference to xmlparserv2 and leaving the ones to cr

  • Sharing data between two canvases on the same form ?

    Hello, I have one form with two canvases and two data blocks. Datablock A and datablock B are same tables. The reason I split is so I can have a search field on canvas A, then after executing the query, I want to populate canvas B. I'm having trouble