Caching images in runtime for textflow or text area

Hi,
I am building a chat app, each user has a picture.  So each time a user talks, I display their picture along side with what they typed.  I only know the URL of the picture at run time.  Here's what I'm trying to do:
var p:ParagraphElement = new ParagraphElement();
img = new InlineGraphicElement();
img.source = "http://www.something.com/image.jpg";
img.height = 40;
img.width = 40;
p.addChild(img);
var s:SpanElement = new SpanElement();
s.text = "Username: ";
p.addChild(s);
textArea.textFlow.addChild(p);
The above code shows the image fine.  However, the moment I add these lines:
var p1:ParagraphElement = new ParagraphElement();
p1.addChild(img);
The first image disappears...  How do I reuse that orginal image element?
Thanks!

If I do that, will it make 2 HTTP requests to grab the same image?  My original design was to use TextFlow with <img> tag, but after I load the same image a few times, I realise that it's making a HTTP request for the same image every time.
The question is if I want to load the same image in a textarea/textflow multiple times, how do I do it without the SWF making multiple HTTP requests.
Thanks!

Similar Messages

  • XSL Stylesheet for Form with TEXT AREA not responding to DATASRC or DATAFLD

    I have a stylesheet for Form which displays data in the input boxes for edit and re submit.
    While all input text boxes show data from the database, TextArea box does not display the value for edit
    <div align="left">
    <table border="0" cellpadding="0" cellspacing="0"
    width="600">
    <tr>
    <td width="600" height="1">
    <font face="Arial" size="2">17. Describe how
    the accident or exposure
    happened</font>
    <textarea rows="3"
    name="P_ACCD_TXT"
    datafld="{ACCD_TXT}"
    onblur="javascript:while(''+this.value.charAt(0)==' ')this.value=this.value.substring(1,this.value.length);"
    cols="72">
    </textarea>
    </td>
    </tr>
    </table>
    </div>
    In other input boxes value="{column_name}" works, but value attribute is not available for textarea. both datasrc="{ACCD_TXT}" and datafld="{ACCD_TXT}" do not work.
    Is it because datsrc and datafld are not supported. Would very much appreciate if some one can clarify on tthis and advise how to go about retreiving data into textarea box
    Thanks

    datasrc and datafld are Microsoft IE specific "data binding" attributes that are supported in the MS IE5 implementation of HTML.
    What you likely want is just the standard HTML way of putting data into a <textarea> that you would do in XSLT like this:
    <textarea>
    <xsl:value-of select="ACCD_TXT"/>
    </textarea>assuming that the current node has a child element named <ACCD_TXT> in the source document.

  • SetText() works for one text area but not for another

    I am student new to java so forgive me if I'm making an obvious mistake. I have a GUI with 3 tabs. Two tabs have a text area in each in them and an action listener tells the textarea what to print. The problem is one text area works and the other doesn't. they are declared in the same way so I can't see why the problem occurs.

    If you have copied and pasted code for the second one, it is possible that you are setting text for the first text area at both the places. Check if you are calling the setText method on both the text areas and not the same one twice.

  • Master data loads for Attributes and texts failing

    Hello
    Master data loads for Attributs and texts are failing. The error is
    1. Lock Not set for Loading master data attributes
    2.Table /BI0/YAccount does not exists (this error is for 0Account master data - attribute load)
    3.Error  1 in the update.
    We had faced this error few days ago and rebooting the server resolved the error but it has recurred after 4 days.
    RS12 and SM12 do not show any locks. Activating the info object has also not resolved the error.
    Any insight is appreciated.
    Thanks
    Inder

    Hello
    Master data loads for Attributs and texts are failing. The error is
    1. Lock Not set for Loading master data attributes
    2.Table /BI0/YAccount does not exists (this error is for 0Account master data - attribute load)
    3.Error  1 in the update.
    We had faced this error few days ago and rebooting the server resolved the error but it has recurred after 4 days.
    RS12 and SM12 do not show any locks. Activating the info object has also not resolved the error.
    Any insight is appreciated.
    Thanks
    Inder

  • How do I make a custom Scrollbar Text area in FlashCC HTML5 Canvas?

    Hello,
    I need to make a scrollbar for a long text area. I wonder how can I achieve this with HTML5 canvas in Flash CC2014?
    Thanks,
    Rodrigo

    the text looks ok to me, http://www.kglad.com/Files/forums/test2.html
    but yes, you can scroll a movieclip too.

  • Help with changing the size of a text area

    hi. i have a a couple of text areas lined up vertically in a <Vgroup>. each text area is populated with data from xml. but sometimes there isn't much data for a particular text area and i'd like to reduce the number of rows on the text area so there isn't so much blank space. just not sure best way to go about it. any suggestions would be great. cheers.

    Try the following code.
    <s:TextArea
         id="ta"
         updateComplete="{ ta.height = ta.scroller.viewport.contentHeight + 2 }"; />
    Regards,
    Anitha

  • Turning off caching for loading a text file

    I'm new to AS3 and don't understand the properties setting
    for URLRequest. I'm trying to turn caching off so when I reload the
    text file, it always gets a fresh copy. I keep getting compiler
    errors however with the useCache line. I'm not accessing the
    properties correctly or something. When I take out that line it
    works fine but always fetches the cached file.
    My code is:
    loadDoctorVariables();
    function loadDoctorVariables() {
    var requestJo:URLRequest = new URLRequest("
    http://www.grxsolutions.com/gtslideshow3/"+doctorURL+".txt");
    //requestJo.useCache(false);
    requestJo.useCache = false;
    var variables:URLLoader = new URLLoader();
    variables.dataFormat = URLLoaderDataFormat.VARIABLES;
    variables.addEventListener(Event.COMPLETE, completeHandler);
    try
    variables.load(requestJo);
    catch (error:Error)
    trace("Unable to load URL: " + error);
    function completeHandler(event:Event):void {
    var loader:URLLoader = URLLoader(event.target);
    trace(loader.data.dayNames);
    trace(loader.data.monthNames);
    trace(loader.data);
    trace(loader.data.saturationColor);
    //saturationColor=10&hue=100&tint=255&bright=12&bgimage=ironman&slidesused=1,2,3,4,7,8,9, 10,11&voice=male1&alternateslides=7,doctorbob1,11,doctorbob2
    }

    append a random string to the URL, ie
    var requestJo:URLRequest = new URLRequest("
    http://www.grxsolutions.com/gtslideshow3"+doctorURL+".txt"+"?c="+Math.random());

  • Caching images

    Hi,
    In my scenario, there can be multiple board area for an user.  When an user logs in 5 images for that board area get picked from the database table and cached.  If any other user for the same board area logs in, system should check cache first.  If found, then it should pick from cache or else go to database table to pick the pictures.  I have pasted the code below to show how the pictures are being cached in my application.  Can anyone help me out with retrieving the pictures explicitly from cache.  A code snippet will be very helpful.  Thanks in advance.
    Regards
    Goutam
    Code to cache image
        IF XSTRLEN( <ls_lso_news_st>-img ) > 0.
          CREATE OBJECT lref_cached_response
            TYPE
              cl_http_response
            EXPORTING
              add_c_msg        = 1.
          lref_cached_response->set_data( <ls_lso_news_st>-img ).
          lref_cached_response->set_status( code = 200 reason = 'OK' ).
          lref_cached_response->server_cache_expire_rel( expires_rel = 180 ).
    GUID / UUID functions
          CALL FUNCTION 'GUID_CREATE'
            IMPORTING
              ev_guid_32 = lf_guid.
          CONCATENATE runtime->application_url '/' lf_guid INTO lf_img_st.
          cl_http_server=>server_cache_upload( url      = lf_img_st
                                               response = lref_cached_response ).
        ENDIF. " XSTRLEN
        ls_s_st_new-header     = <ls_lso_news_st>-header.
        ls_s_st_new-body       = <ls_lso_news_st>-body .
        IF <ls_lso_news_st>-link_name IS NOT INITIAL.
          ls_s_st_new-link_name      = <ls_lso_news_st>-link_name.
          CONCATENATE 'http://' <ls_lso_news_st>-link '/' INTO <ls_lso_news_st>-link.
          ls_s_st_new-link = <ls_lso_news_st>-link.
        ENDIF.

    Hi Raja,
    Thanks for your reply, but i guess i was not able to make you understand my scenario.  Multiple user ID can belong to a board area.  Say, for board area CRM, there are 5 user IDs.  From the admin page, news images are uploaded for a board area and they are saved in database table in XSTRING format.  In my application, I check which board area any user ID belong to and get the images from the database table and set them one by one to cache as I have depicted in the code and display using the URL from the cache, but it happens every time.  what i want now is if any user belonging to same board area logs in, it should not go to the database table to pick the image in XSTRING format and set it to cache one by one again.  For that I saved the news link for that board area in another database table.  So application picks all the links from database table and display them from cache.  But if cache time gets replased, image does not get displayed.  I only want to know the process by which I can find out whether a number of images that I uploaded to cache, those are existing or not, i.e. whether caching time has elapsed.
    Please let me know if you have any suitable solution for this.
    Regards
    Goutam Dutta

  • Is there a way to expand the text area of the login/lock screen for the warning message?

    I put our company's standard warning message in the Security & Privacy system preference ("Show a message when the screen is locked.") and it overflowed the allotted text area for the warning message text on the login screen and lock screens.  It seems that the area allows about 250 character messages and I need to provide about 500 characters.  Is there any way to expand the text area allotted for this purpose?
    Bob Reed

    To be a little more specific about the challenge I'm facing, I want to increase the allotted text space for the field I've outlined in the attached image.  Seems like there ought to be a NIB file that could be edited to accomplish this task:
    I would appreciate any advice on which file should be edited to expand the text field.
    Bob Reed

  • Changing Images at Runtime...it's sending me nuts (I'm a newbie, go easy)

    Hi all,
    I am trying change images at runtime and quite frankly it's driving me nuts. I'm pretty new to Java and don't understand some of the principles but I'm trying. I have this code below, that loads up a few images. I want to be able to change some/all of these images either on a timed even or on a button press, but all the things I've tried don't work. Can someone offer me some help....thanks in advance
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class bc extends JFrame implements ActionListener {
         public static void main(String[] args) {new bc();}
         bc() {
              //setUndecorated(true); // - this removed the titlebar!
                    setTitle("BC...");
              setSize(350,125);
              setResizable(false);
              setLocation(50,50);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              setBackground(new Color(0,0,0));
              getContentPane().setBackground(new Color(255,255,255));
              JPanel hours = new JPanel();
              hours.setLayout(new GridLayout(4,2));
              hours.add(hour14);
              hours.add(hour24);
              hours.add(hour13);
              hours.add(hour23);
              hours.add(hour12);
              hours.add(hour22);
              hours.add(hour11);
              hours.add(hour21);
              JPanel mins = new JPanel();
              mins.setLayout(new GridLayout(4,2));
              mins.add(min14);
              mins.add(min24);
              mins.add(min13);
              mins.add(min23);
              mins.add(min12);
              mins.add(min22);
              mins.add(min11);
              mins.add(min21);
              JPanel secs = new JPanel();
              secs.setLayout(new GridLayout(4,2));
              secs.add(sec14);
              secs.add(sec24);
              secs.add(sec13);
              secs.add(sec23);
              secs.add(sec12);
              secs.add(sec22);
              secs.add(sec11);
              secs.add(sec21);
              JPanel helptext = new JPanel();
              helptext.setLayout(new GridLayout(4,2));
              helptext.add(new JLabel("8"));
              helptext.add(new JLabel("4"));
              helptext.add(new JLabel("2"));
              helptext.add(new JLabel("1"));
    //add action listenters
              changeImg.addActionListener(this);
              JPanel cp = new JPanel();
              cp.setLayout(new GridLayout(1,6));
              cp.setBackground(new Color(255,255,255));
              cp.add(hours);
              cp.add(mins);
              cp.add(secs);
              cp.add(helptext);
              cp.add(changeImg);
              setContentPane(cp);
              setVisible(true);
         public void actionPerformed(ActionEvent ae) {
              hour11.PaintOff(1);
              //JOptionPane.showMessageDialog(this, "changed");
              repaint();
    JPanel hour11 = new PaintOff(0);
    JPanel hour12 = new PaintOff(0);
    JPanel hour13 = new PaintBlank();
    JPanel hour14 = new PaintBlank();
    JPanel hour21 = new PaintOff(0);
    JPanel hour22 = new PaintOff(0);
    JPanel hour23 = new PaintBlank();
    JPanel hour24 = new PaintBlank();
    JPanel min11 = new PaintOff(0);
    JPanel min12 = new PaintOff(0);
    JPanel min13 = new PaintOff(0);
    JPanel min14 = new PaintOff(0);
    JPanel min21 = new PaintOff(0);
    JPanel min22 = new PaintOff(0);
    JPanel min23 = new PaintOff(0);
    JPanel min24 = new PaintOff(0);
    JPanel sec11 = new PaintOff(0);
    JPanel sec12 = new PaintOff(0);
    JPanel sec13 = new PaintOff(0);
    JPanel sec14 = new PaintOff(0);
    JPanel sec21 = new PaintOff(0);
    JPanel sec22 = new PaintOff(0);
    JPanel sec23 = new PaintOff(0);
    JPanel sec24 = new PaintOff(0);
    JButton changeImg = new JButton("change");
    }///---------This is my PaintOff class ---------------\\\
    import javax.swing.*;
    import java.awt.*;
    import java.awt.Image.*;
    public class PaintOff extends JPanel {
    Toolkit tk = Toolkit.getDefaultToolkit();
    public Image imgOff = tk.getImage("off.jpg");
    public Image imgOn = tk.getImage("on.jpg");
    public Image paintMe = tk.getImage("off.jpg");
         PaintOff(int a) {
              if(a == 1) {
                   vOn();
              } else {
                   vOff();
         public void vOn() {
            paintMe = imgOn;
         //JOptionPane.showMessageDialog(new bc(), "shown");
         public void vOff() {
            paintMe = imgOff;
         public void paintComponent(Graphics g) {
              g.drawImage(paintMe,0,0,this);
    }PaintBlank class is not included here, it's basically just the same as PaintOff but only has one image inside.
    When I try and compile this code, I get
    C:\jdk1.4\bin\bclock>javac bc.java
    bc.java:79: cannot resolve symbol
    symbol : method PaintOff (int)
    location: class javax.swing.JPanel
    hour11.PaintOff(1);
    ^
    1 error
    I don't understand this either, I've tried replacing "PaintOff(1)" with "vOn()" but I get the same error. This is baffling to be, as I thought that the hour11 would have access to all the methods inside the PaintOff class?
    Anyway, thanks for any help you guys give me!
    Cheers
    //Chris.

    Hi!
    Your problem is that you've used a widening conversion to convert from PaintOff to a JPanel. JPanel has no such method, and so the compiler is complaining that it can't find it.
    e.g
    public class NoCompile{
         public static void main(String args[]){
              One one = new Two();
              one.methTwo();
    public class Two extends One{
         public Two(){}
         public void methTwo(){
            System.out.println("Executed 2");
    public class One{
         public One(){}
         public void meth1(){}
    } will give you the same sort of error message. To make the compiler happy, use a cast.
    Now this will compile and gives the right result.
    public class NoCompile{
         public static void main(String args[]){
              One one = new Two();
              ((Two)one).methTwo();
    }So in your case, you want to do
    ((PaintOff)hour11).vOn();
    Does that help?
    :) jen

  • Best practice for images. Air for Android

    Hey guys...
    I was thinking about the best solution when it comes to images storage for Air on Android.
    Since I dont have much experience with non-web based apps, I thought of two way and I would like to know your thought on them.
    1.Application Storage Directory. If I get it right, this folder is created when the app is installed and the project can access files in it. Any idea on how this can work with images?
    2.Database. My app uses a local database anyway so maybe that the proper way to do it. I've done some research and found out that the image must be converted to a byte array (thats easy) but then I dont have a clue on how to save it to the database.
    So? Which one is better for the mobile world?
    Also, if there are other ways let me know please.

    While I am no expert in this area, I did run across this blog:
    http://www.remotesynthesis.com/post.cfm/local-caching-of-remote-images-in-air-for-android
    It deal with local caching of remotely loaded images.  Should be exactly what you are looking for.
    Darren

  • How to use Cache Management Library (CML) for custom applications?

    Hello,
    We are planning the migration of multiple applications (J2EE, Portal, Web-Dynpro for Java) from 7.01 to 7.3 and we would like to replace some custom cache implementations with a central cache management provided by the SAP Web-AS Java.
    Several SAP standard services (e.g. UME, Configuration Manager, Scheduler) seems to use the "Cache Management Library" (CML):
    [http://help.sap.com/saphelp_nw73/helpdata/en/4a/f833eb306628d2e10000000a42189b/frameset.htm]
    Such caches can be monitored using SAP Management Console (AS Java Caches).
    Portal Runtime (cache_type=CML) and Web Page Composer can also be configured to use CML:
    [http://help.sap.com/saphelp_nw73/helpdata/en/49/d822a779cf0e80e10000000a42189b/frameset.htm]
    [http://help.sap.com/saphelp_nw70ehp2ru/helpdata/en/13/76db395a3140fcb17b8d24f5966766/frameset.htm]
    So our questions:
    How to use CML for custom applications?
    Is there any example or documentation available?
    Kind Regards,
    Dirk

    Thanks Vidyut! You've answered my question.
    I placed the jar file in the $CATALINA_HOME/shared/lib directory. But where should I place the taglib TLD file? And how should I reference it in web.xml?
    Currently, my web.xml is as follows and it doesn't work.
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <taglib>
    <taglib-uri>http://abc.com</taglib-uri>
    <taglib-location>c:\Tomcat\shared\lib\mytags-taglib.tld</taglib-location>
    </taglib>
    </web-app>
    Thanks again!
    Joe

  • Open original image instead of cached image

    While the title in itself is rather self explanatory, I'll elaborate somewhat. The current state of opening sent images means opening the cached version - the file name is wrong in that case, and often times the cached image is in wrong format or size, perhaps even compressed too much; Which might not be the preferable action for a large number of people. Could we possibly get a toggle in Options, or even default left-clicking images to opening the actual image, rather than the image cache?

    Hi Gramps,
    Sorry for this late response. I tried the method you pointed to, but it did not work properly, but I got to doing what I wanted to by changing the .css for the classes and also making a new class in the SpryValidationTextField.css etc.and then applying it in the source code among the span tags.
    I have a new question, but will post it separately.
    zabberwan

  • Java + Safari causes page to 'flash' (i.e. reload even cached images)

    Does anyone know if this is able to be corrected or at least why this occurs?
    For Safari 4 beta when Java is active my site http://www.theimagecache.com 'flashes' a lot (i.e.reloads even cached images). Whereas with Java disabled this does not happen and the pages load considerably more quickly.
    I hadn't noticed this before in Safari 3+... but then again... I usually had Java turned off for security reasons so it may have existed then as well.
    But in Firefox 3.1b3, even with Java turned on the pages load very slightly more slowly (i.e. literally only about a fraction of a second more slowly... which is understandable) but they do not 'flash' (i.e. reload cached images).
    Any ideas as to if this can be corrected so viewers that have Java on by default and are using Safari do not see all of this flashing and slower loading?
    Thanks for any input.
    Ron

    Thanks Michael for posting.
    Yes... this Safari beta may be the problem, because even after the images have been cached often many of the images on a new page (that have already been cached) reload.
    Whereas in Firefox 3.1b3 (beta) this does not happen.
    Hopefully they'll get this fixed.
    Thanks again.
    Hope things are going well for you there in Sweden, considering all of the world economic problems.

  • Placing Images (Screen Caps) for Callouts - Best Practice?

    Illustrator CS6, Windows 7
    I'm placing screen captures (screen images from software) in my artwork files to add callouts and create illustrations for a user manual.
    The machine I'm capturing on has a screen resolution set at 1920 x 1080 (required for software). I'm using Snagit and capturing the screens, saving files, then placing in Illustrator. I've been using images minimum 300 dpi and never upsizing in Illustrator. Still I think my results could be better.
    In the past I've used .jpg as my export filetype for placing into Illustrator. But, recent reads of postings in this community lead me to believe my practice might be flawed.
    Question: What is considered best practice for placing images from screen capture (or any source) in Illustrator? What file type from capture will get me the clearest and most adaptable results?
    My Illustrator file color mode is CMYK and my other art and callouts supporting the screen cap are working great.
    I'm creating the artwork for import to Framemaker and creating a PDF for online and print.

    What I mean is; what is the user looking at, and what are you training on?
    For example, if the application involves medical imaging, and part of your documentation covers something like evaluating medical images in the application, that would probably be a far more color-critical scenario than an application in which the user just views and manipulates data.
    Generally, you don't need anything like 300 PPI for screen captures in software documentation. The whole intent is for the image to look like the screen you are documenting, which is something like 72 or 96 PPI at actual size. You might downscale a screen capture as much as 50%, but at that size, the reader is viewing the application's text (including menus,  etc.) at half the size as viewed in the application, which is assumed to be sized for comfortable reading. Sharpness is good. You don't want the images to become blurred in pursuit of completely needless "resolution."
    Also generally speaking, software screenshots are not usually color-critical. Placing (even pasting from SnagIt) directly into the page layout app is usually just fine. PostScript knows how to separate RGB images. Such things have been done since long before anyone sweated blood over "color management." Assuming your application interface is not using garish color (which would be poor interface design; it's tiring), I dare say the conversion of RGB screenshots to CMYK at the imagesetter or press would be fine.
    How is the manual going to be printed? Unless you're talking about a large press runs, nowadays software documentation (subject to frequent updates) is often printed on on-demand presses (think glorified digital color copiers), not sheetfed presses. With software documentation, you're not usually talking coffee-table collector's books. (The exception would be something like a book on color-correction in Photoshop; thus my first question.)
    I routinely paste screenshots from SnagIt directly into InDesign pages to document software applications, and add the callouts in InDesign. Only when I need some special graphics (swooping arrows, etc.) do I assemble the callouts to the screenshots in Illustrator; and even when I do that, I also typically paste the SnagIt captures directly in to AI.
    Keeping your callouts native to the page layout program also better facilitates language translation, when you have to outsource that.
    JET

Maybe you are looking for