Is it possible to add paragraphs with actionscript?

If I have an object like
<s:RichText id="foo">
<s:content></s:content>
</s:RichText>
Can I manually add paragraphs to it with actionscript?
I want to manually create a new paragraph, assign a string to it, and then stash it in the RichText object.  So I can use a loop to create as many paragraphs as I might need.
Such as
for each (s:String in myCollection) {
   [ foo add a p element with s in it ]

I think I've got it:
var textFlow:TextFlow = new TextFlow();
for each ( var s:String in instructionsArray)
     var p:ParagraphElement = new ParagraphElement();
     var span:SpanElement = new SpanElement();
     span.text = s;
     p.replaceChildren(0, 0, span);
     textFlow.replaceChildren(textFlow.numChildren, textFlow.numChildren, p);
instructionText.content = textFlow;
Where "instructionText" is a RichText object.
This is very, very cool, btw.

Similar Messages

  • AdvancedDataGrid - Add columns with ActionScript

    I'm trying to add columns to an AdvancedDataGrid via ActionScript.
    I can't get it to work.
    I've tried two approaches -- One with an intermediary array to store the columns then set the adg's columns to the array; One where I assign the columns directly to the adg's columns array.
    They both fail in their own way.  The columns don't "take" and the adg uses the dataProviders defaults, or there are no columns at all.
    "adg_test.mxml" has the AdvancedDataGrids/code. 
    "adg_test_renderer.mxml" is a renderer for one of the columns.
    Would appreciate learning what I'm doing wrong.
    Thanks for any help.
    === START adg_test_renderer.mxml  ===
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">
         <mx:Button id="btnTest" label="Renderer Working"/>
    </mx:VBox>
    === END adg_test_renderer.mxml  ===
    == START adg_test.mxml ====
    <?xml version="1.0"?>
    <mx:Application
        xmlns:mx="http://www.adobe.com/2006/mxml"
        initialize="init()">
        <mx:Script>
          <![CDATA[
             import mx.collections.ArrayCollection;
             [Bindable]
             private var dpADGExplicit:ArrayCollection = new ArrayCollection([
               {Artist:'Pavement', Album:'Slanted and Enchanted', Price:11.99},
               {Artist:'Pavement', Album:'Brighten the Corners', Price:11.99},
               {Artist:'Saner', Album:'A Child Once', Price:11.99},
               {Artist:'Saner', Album:'Helium Wings', Price:12.99},
               {Artist:'The Doors', Album:'The Doors', Price:10.99},
               {Artist:'The Doors', Album:'Morrison Hotel', Price:12.99},
               {Artist:'Grateful Dead', Album:'American Beauty', Price:11.99},
               {Artist:'Grateful Dead', Album:'In the Dark', Price:11.99},
               {Artist:'Grateful Dead', Album:'Shakedown Street', Price:11.99},
               {Artist:'The Doors', Album:'Strange Days', Price:12.99},
               {Artist:'The Doors', Album:'The Best of the Doors', Price:10.99}
             [Bindable]
             private var dpADGActionScript:ArrayCollection = new ArrayCollection([
               {Artist:'Pavement', Album:'Slanted and Enchanted', Price:11.99},
               {Artist:'Pavement', Album:'Brighten the Corners', Price:11.99},
               {Artist:'Saner', Album:'A Child Once', Price:11.99},
               {Artist:'Saner', Album:'Helium Wings', Price:12.99},
               {Artist:'The Doors', Album:'The Doors', Price:10.99},
               {Artist:'The Doors', Album:'Morrison Hotel', Price:12.99},
               {Artist:'Grateful Dead', Album:'American Beauty', Price:11.99},
               {Artist:'Grateful Dead', Album:'In the Dark', Price:11.99},
               {Artist:'Grateful Dead', Album:'Shakedown Street', Price:11.99},
               {Artist:'The Doors', Album:'Strange Days', Price:12.99},
               {Artist:'The Doors', Album:'The Best of the Doors', Price:10.99}
            private function init():void
                var arr:Array=[];//Intermediary array that will become the AdvancedDataGridColumn array
                var col:AdvancedDataGridColumn = new AdvancedDataGridColumn();
                col.dataField = "Artist";
                arr.push(col);
                col.dataField = "Album";
                col.visible = false;
                arr.push(col);
                col.dataField = "Price";
                col.itemRenderer = new ClassFactory(adg_test_renderer);
                arr.push(col);
                adgActionScript.columns = arr;
                //ALTERNATE UNSUCCESFUL APPROACH
                col.dataField = "Artist";
                adgActionScript.columns.push(col);
                col.dataField = "Album";
                col.visible = false;
                adgActionScript.columns.push(col);
                col.dataField = "Price";
                col.itemRenderer = new ClassFactory(adg_test_renderer);
                adgActionScript.columns.push(col);
          ]]>
        </mx:Script>
        <mx:Label text="Explicit Columns"/>
        <mx:AdvancedDataGrid
            id="adgExplicit"
            width="100%" height="100%"
            sortExpertMode="true"
            dataProvider="{dpADGExplicit}">
            <mx:columns>
                <mx:AdvancedDataGridColumn dataField="Artist" />
                <mx:AdvancedDataGridColumn dataField="Album" visible="false"/>
                <mx:AdvancedDataGridColumn dataField="Price" itemRenderer="adg_test_renderer"/>
            </mx:columns>
       </mx:AdvancedDataGrid>
       <mx:Label text="ActionScript Columns (If ActionScript works: Arist column should be hidden. Should see Album column with data and Price column with buttons."/>
        <mx:AdvancedDataGrid
            id="adgActionScript"
            width="100%" height="100%"
            sortExpertMode="true"
            dataProvider="{dpADGActionScript}">
       </mx:AdvancedDataGrid>
    </mx:Application>
    == END adg_test.mxml ====

    Thanks so much for your help.
    Here's how I altered your code for my example.  This logic allows easier assignment of additional column parameters.
    === START adg_test_renderer.mxml  ===
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">
        <mx:Button id="btnTest" label="Renderer Working"/>
    </mx:VBox>
    === END adg_test_renderer.mxml  ===
    == START adg_test.mxml ====
    <?xml version="1.0"?>
    <mx:Application
        xmlns:mx="http://www.adobe.com/2006/mxml"
        initialize="init()">
        <mx:Script>
          <![CDATA[
             import mx.collections.ArrayCollection;
             [Bindable]
             private var dpADGExplicit:ArrayCollection = new ArrayCollection([
               {Artist:'Pavement', Album:'Slanted and Enchanted', Price:11.99},
               {Artist:'Pavement', Album:'Brighten the Corners', Price:11.99},
               {Artist:'Saner', Album:'A Child Once', Price:11.99},
               {Artist:'Saner', Album:'Helium Wings', Price:12.99},
               {Artist:'The Doors', Album:'The Doors', Price:10.99},
               {Artist:'The Doors', Album:'Morrison Hotel', Price:12.99},
               {Artist:'Grateful Dead', Album:'American Beauty', Price:11.99},
               {Artist:'Grateful Dead', Album:'In the Dark', Price:11.99},
               {Artist:'Grateful Dead', Album:'Shakedown Street', Price:11.99},
               {Artist:'The Doors', Album:'Strange Days', Price:12.99},
               {Artist:'The Doors', Album:'The Best of the Doors', Price:10.99}
             [Bindable]
             private var dpADGActionScript:ArrayCollection = new ArrayCollection([
               {Artist:'Pavement', Album:'Slanted and Enchanted', Price:11.99},
               {Artist:'Pavement', Album:'Brighten the Corners', Price:11.99},
               {Artist:'Saner', Album:'A Child Once', Price:11.99},
               {Artist:'Saner', Album:'Helium Wings', Price:12.99},
               {Artist:'The Doors', Album:'The Doors', Price:10.99},
               {Artist:'The Doors', Album:'Morrison Hotel', Price:12.99},
               {Artist:'Grateful Dead', Album:'American Beauty', Price:11.99},
               {Artist:'Grateful Dead', Album:'In the Dark', Price:11.99},
               {Artist:'Grateful Dead', Album:'Shakedown Street', Price:11.99},
               {Artist:'The Doors', Album:'Strange Days', Price:12.99},
               {Artist:'The Doors', Album:'The Best of the Doors', Price:10.99}
            private function init():void
                var arrCols:Array = adgActionScript.columns;
                var col:AdvancedDataGridColumn;
                col = new AdvancedDataGridColumn;
                col.dataField = "Artist";
                arrCols.push(col);
                col = new AdvancedDataGridColumn;
                col.dataField = "Album";
                col.visible = false;
                arrCols.push(col);
                col = new AdvancedDataGridColumn;
                col.dataField = "Price";
                col.itemRenderer = new ClassFactory(adg_test_renderer);
                arrCols.push(col);   
                adgActionScript.columns = arrCols;
                adgActionScript.validateNow();
          ]]>
        </mx:Script>
        <mx:Label text="Explicit Columns"/>
        <mx:AdvancedDataGrid
            id="adgExplicit"
            width="100%"
            height="100%"
            dataProvider="{dpADGExplicit}">
            <mx:columns>
                <mx:AdvancedDataGridColumn dataField="Artist" />
                <mx:AdvancedDataGridColumn dataField="Album" visible="false"/>
                <mx:AdvancedDataGridColumn dataField="Price" itemRenderer="adg_test_renderer"/>
            </mx:columns>
       </mx:AdvancedDataGrid>
       <mx:Label text="ActionScript Columns"/>
        <mx:AdvancedDataGrid
            id="adgActionScript"
            width="100%"
            height="100%"
            dataProvider="{dpADGActionScript}">
       </mx:AdvancedDataGrid>
    </mx:Application>
    == END adg_test.mxml ====

  • Add states with ActionScript, because MXML states occupying space

    I have my States setup with MXML fine, but I noticed that even though the State is not currently set, it is occupying space and leaving a huge empty gap in my layout.
    I want the State to not occupy the space when it is not the active State.
    I think using ActionScript to dynamically add the State when it is needed will solve the problem. What is the ActionScript code to add States (to replace all the State MXML code below)?
    <mx:Labe text="No State should be visible and don't occupy any space" />
    <mx:states>
    <mx:State name="{displayThisState}">
    <mx:AddChild>
    </mx:AddChild>
    </mx:State>
    </mx:states>
    Thanks.

    I'll recommend you to use a ViewStack instead of States, States in Fx 3 are kinda diffucult to declare and manage as your app grows. Fortunately in the Flex SDK 4 there will be a much simpler syntax to declare states.

  • Possible to add "Open With " option to Spotlight?

    When I do a search in Spotlight, it brings up a list of files. I do show all, then right click on an item. It shows "open"... "get info"... "reveal in finder"... etc. Is there a way to add an "open with" option, lets say with a plugin or shareware of some sort? Word documents always default to the Microsoft Office Test Drive program, which I do not intend to buy. I want these to default to an older version of Office I have, but it can't be done in Spotlight, and even in "get info", I cannot make a permanent change to have Word documents open with a prior version of Office.
    Mac Mini   Mac OS X (10.4.2)  

    Matt, is there any reason to keep the Test Drive installed on your machine? If you remove that then I'd think the documents would open with the older version once again.
    As far as your actual question goes, I don't know of any way to add an 'open with' function, but on the other hand I don't know my way around Spotlight all that well -

  • Is it possible to add audio with a simple play/pause button and also have a clickTag attached to the full stage?

    my client wants to add audio to their banner ad (which always has a full stage clickTAG set). I'm trying to figure out a way to just use a simple play/pause button and attach a toggle action to it. Problem is when the user clicks it's going to the clickTAG URL that's attached to the full stage. Is there any way around this?
    Please advise and thank you in advance.

    I have the same issue. It is pretty annoying but at least the audio remains within the motion project. It just isn't accessible it seems as an FCPX template. So what I'm doing is this:
    I still use the video within FCPX's generator section so that you can edit the parameters as you need to
    For the audio, open the project in motion then under Share, click 'Export Audio'. Select 'CAF' format and save to your hard disk
    I then import the audio file into an event I set up specifically for this purpose (per BenB's suggestion).
    When I need it, I then insert the generator from the generators section and then attach the audio file below the primary story line for the audio track
    It isn't pretty but it works.

  • In contacts there is the possibility to add a new event, as the birthdays, but they do not appear in iCal. Is there any way to make that possible? It is normal to have a person with his birthday, anniversary and others key dates you want to link to him.

    In contacts there is the possibility to add a new event, as the birthdays, but they do not appear in iCal. Is there any way to make that possible? It is normal to have a person with his birthday, anniversary and others key dates you want to link to such person, but the only one shows up is the birthday. How to be able to show all those dates linked to people in the agenda in the iCal?
    Thanks

    Hi,
    I sugggest you try my application, Dates to iCal. It is shareware with a 2 week trial period.
    Dates to iCal 2 is a replacement for Apple's birthday calendar for iCal. It has a range of features to allow the user to choose what, and what not, to sync to iCal from Address Book.
    As well as automatically syncing birthday dates from Address Book, Dates to iCal 2 can sync anniversary and custom dates. It can set up to five alarms for each date in iCal and can also set different alarms for birthdays and anniversaries. It allows the option of only syncing from one Address Book group. This application also allows for the titles of the events sent to iCal to be modified to the user's preference.
    Best wishes
    John M
    As I sell software on my site and ask for donations, the Apple Support Communities Use Agreement requires that I state that I may receive some form of compensation, financial or otherwise, from my recommendation or link.

  • Is it possible to add a second monitor via mac mini with iMac

    Hi
    is it possible to add a second monitor via mac mini with iMac
    or is there another solution?
    all i want to know is if i can run a second monitor or link a mac mini for more speed like i heard you can with the G5 Towers.

    The iMac will allow you to connect a second monitor but that monitor will show the same thing as the iMac's built-in screen.
    You can network a Mac mini and iMac via Ethernet or Firewire.
    Software load sharing like Xgrid can allow you to share work between the Macs.

  • In IMovie11, is it possible to add a menu page with options such as PLAY, SCENES, TRAILER, etc

    In IMovie11, is it possible to add/create a menu at the beginning of the movie with options like PLAY MOVIE, SCENES, TRAILER, etc..

    *I found a solution. HP owes me $20,000 in consulting fees.*
    To print to a LaserJet 3600 or 2600 from a newer Mac using 10.6, you must do the following:
    Step 1: Install Foomatic HPIJS drivers
    Step 2: Get an AirPort Express or equivalent print server
    Step 3: Connect the printer via USB to the print server, and connect
    Step 4: Go to Print & Fax, then click the + button to add a printer
    Step 5: Select HP Jetdirect - Socket for the protocol
    Step 6: Enter the IP address of the printer server, followed by a colon and the port number (9100 or 9101)*, i.e. 1.2.3.4:9100
    Step 7: Name the printer, then click on the Print using: drop down menu
    Step 8: Select the Select Other Printer..., and choose the appropriate HPIJS driver.
    * To determine the correct port, open Network Utility in the Utilities folder. Click on Port Scan. Type the IP address of your print server, then check the Only test ports between... and enter 9100 and 9101. It will report back the open TCP port.

  • Is it possible to add new columns with format "Text" once a table is linked to a form

    Is it possible to add new columns with format "Text" once a table is linked to a form in Numbers for iPhone or is it impossible and thus a serious bug?(Rating stars and numeric vales seem to work.)
    Those bugs happen both for new speadsheets as well as existing onces, like the demo. When you are in the form only the numeric keyboard shows up.
    Pat from the Apple Store Rosenstrasse/Germany approved that it looks like a Bug during the Numbers Workshop I was in: It is not possible to add new columns with format "Text". I reported the error for Version 1.4 but there is no update nor do I get statement of understanding the issue.

    Hi Knochenhort,
    I see what you are talking about now. Without knowing how the program actually works, I think this is what's going on:
    When you add a new column to an already existing table (with already existing formats), the new cells come already formatted like the previous column. So when you add a column to the end of the demo table, the cells are already formatted like stars, and when you add a column to the beginning, they're already formatted like number.
    I think this is why it's different when if you add columns to a table with blank (unformatted) columns. In that case, the new cells aren't already "tainted" with a set format, so you can change to text format without issue.
    It seems like the problem is that you can't format cells that are already formatted as "number" as "text" format (even if it doesn't look like they are, because they are blank). IMO, this is a bug! This is why you don't see this issue when adding columns to a new table, because the new cells don't already come with a format.
    To workaround, you can highlight the body cells after adding the new column, and delete the cells. This will "clear" the formatting, so you can then go in the inspector, format them as text, and the correct keyboard will pop up.
    Hope that helps!

  • Is it possible to add pic/diagram to SP file with link to another SP file?

    Hi,
    Is it possible to add a diagram, picture, or table to a SP file with link to another SP file?
    I know this is possible in, say, Word. For example, I can add a diagram and check a box to include a link to the source file - so that when the diagram in the source file updates, the diagram in my document also updates.
    This is also my goal in SP - instead of simply including a link to a document elsewhere in SP (or on the same site in SP), I would ideally like to display a diagram, picture, or table and include (behind the scenes if possible) to the source SP file
    so that, when the diagram/table in the source SP file updates, my SP file also updates accordingly.
    For example:
    Instead of:
           The diagram is located in:
           link
    I would ideally like:
           Diagram, picture, or table (with link associated with it) - users can click on the diagram or picture if they desire.
           The diagram or picture is updated whenever the source SP file containing the diagram or picture is updated (the source SP
           file will only contain a diagram, picture, or table)
    Any suggestions are welcome.
    Thank you very much.

    Is it possible to add a diagram, picture, or table to a SP file with link to another SP file?
    I know this is possible in, say, Word. For example, I can add a diagram and check a box to include a link to the source file - so that when the diagram in the source file updates, the diagram in my document also updates.
    This is also my goal in SP - instead of simply including a link to a document elsewhere in SP (or on the same site in SP), I would ideally like to display a diagram, picture, or table and include (behind the scenes if possible) to the source SP file so that,
    when the diagram/table in the source SP file updates, my SP file also updates accordingly.
    For example:
    Instead of:
           The diagram is located in:
           link
    I would ideally like:
           Diagram, picture, or table (with link associated with it) - users can click on the diagram or picture if they desire.
           The diagram or picture is updated whenever the source SP file containing the diagram or picture is updated (the source SP
           file will only contain a diagram, picture, or table)
    Any suggestions are welcome.
    Thank you very much.

  • Is it possible to add a string inside a textbox with a value of another textbox for Acrobat Forms?

    Is it possible to add a string inside a textbox with a value of another textbox?
    ex.
    Textbox1 = Happy
    Textbox2 = Sad
    Textbox3 = "I am Happy therefore I am not Sad"
    "I am (value of textbox1) therefore I am not ( value of textbox2)"

    Use this code as the custom calculation code of Textbox3:
    event.value = "I am " + getField("textbox1").value + " therefore I am not " + getField("textbox2").value;
    Notice that the field names are case-sensitive.

  • Is it possible to add color context row with javascript?

    Hi,
    Is it possible to add color context rows for a graphic object with javascript?
    Thanks.

    The match syntax changed between version 12.0 and 12.1, so my recommendation to you is to build an iGrid template the way you would like to do it with javascript, then export the display template from the workbench. 
    Open the template in a text editor and observe the format for the MatchValues, MatchColumns, and MatchColors strings.
    Then your javascript will follow the document.APPLET.gridObject().setMatchXXX("xxxx"); as shown in the script assistant.

  • Want to add an image but with actionscript not a s:Image

    hi. i've looked for a good answer but can't seem to find one...i have a few images i want to add to my app at run time and don't want to use a whole lot of <mx:Image> components...just want to do it with actionscript. i get to the point where i've got an Image object and embedded the source of the Image object but don't know how to add the Image to the display list? thx

    on the same issue...i'd like to use some of the functions of the Sprite class....so i've got my image and added that to a Sprite object but can't seem to add the Sprite to any of the spark/mx containers...keep getting this error:
    Main Thread (Suspended: Error: addChild() is not available in this class. Instead, use addElement() or modify the skin, if you have one.)
    spark.components.supportClasses::SkinnableComponent/addChild
    play/init
    play___play_Application1_creationComplete
    flash.events::EventDispatcher/dispatchEventFunction [no source]
    flash.events::EventDispatcher/dispatchEvent [no source]
    mx.core::UIComponent/dispatchEvent
    mx.core::UIComponent/set initialized
    mx.managers::LayoutManager/doPhasedInstantiation
    mx.managers::LayoutManager/doPhasedInstantiationCallback

  • Is it possible to add tags to files with Adobe Reader?

    Hi,
    I scan many of my hand-written notes from meetings during my work day.  I would love to be able to assign a few tags to the file so that I can find them easier with file searches (in Windows) in the future, without having to put every key word in the file name.  Is it possible to do this with just Adobe Reader, or do I need advanced versions of the software?
    I look forward to any suggestions!

    Not possible with Adobe Reader. Possible with Adobe Acrobat. May be that is possible with your scanning software.

  • Is it possible to add drop down menus with Contribute?

    I need to create a sample dropdown menu for a website for my boss with Contribute. Is it even possible to do this with Contribute alone? Or do I have to do this in dreamweaver?
    Thanks for you help.

    Yes there have been a number of question of on this forum about this. A couple of different solutions have been discussed. Just search the forum and you will get your anwers.

Maybe you are looking for

  • Trying to Burn MP3 CD - Why Does it Require So Many CDs?

    I imported a bunch of my daughter's CDs as MP3 files. When I was done, I created a playlist in iTunes and moved all the MP3 files into it. iTunes tells me that I have 304 songs in the playlist, taking up 696.8 Mb. I then tried to burn the entire play

  • Copying music folders from an old ext HD to a new one

    Hey guys, long time off the discussions, back with a question I hope you can help me in. Got a macbook. Have all my iTunes library on an external HD. Since this HD is failing, bought a new one. The failing HD is not being recognized by my new macbook

  • Image Over Hover not working in IE but fine in Firefox

    I have a new page that I just uploaded today.  You can find it here. http://www.rugged-cctv.com/ruggedhd.shtml If you scroll down to the section labeled Features that ALL of our Advanced DVRs share! with a bright blue background, you will see a pictu

  • Edit a contact while on a call

    How do I update a contact or add information to it while on a call? Here I am talking to someone and they are telling me their new number or email and I can't put it in the device. Do I really have to write it on paper and then wait to transfer it in

  • Runtime fileds in the file generation.

    Hi, I am developing a program to generate a file based on the data from MKPF and MSEG. There are five checkboxes like MATNR, MBLNR, LGORT, BWART etc. Based on the checkboxes selected I need to put these fields in the file. Sometime user may select on