TextField.setTextFormat() not working?

Hi.
I am trying to get setTextFormat working, but I can't seem to get it to work.  The textfield appears and has the text I want, however, the font is just not changing.
Here is my code:
package  {
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFormat;
public class Photograph extends MovieClip {
  var pictureName:TextField = new TextField;
  var pictureNameFormat:TextFormat;
  public function Pictures(aName:String) {
         pictureNameFormat = new TextFormat();
         pictureNameFormat.font = "Verdana";
         pictureNameFormat.align = "center";
         pictureNameFormat.size = "48";
         pictureName.setTextFormat(pictureNameFormat)
         pictureName.x = 500;
         pictureName.y = 500;
         pictureName.text = aName;
         addChild(pictureName);
What am I doing wrong?
Thank you in advance.
Edit: Forgot a line referring to how the text changes itself.
Edit 2: I forgot to add where I created the instance of the textfield and just added it.

Here is the updated code, I tried to tidy it up a bit:
import flash.display.MovieClip;
import flash.text.*;
package{
     public class Photograph extends MovieClip {
          var pictureName:TextField;
          var pictureNameFormat:TextFormat;
          var verdana:Font;
          public function Pictures(aName:String) {
               pictureNameFormat = new TextFormat();
               pictureName = new TextField();
               verdana = new VerdanaClass();
               pictureNameFormat.font = verdana.fontName;
               pictureNameFormat.align = "center";
               pictureNameFormat.size = 48;
               pictureName.setTextFormat(pictureNameFormat)
               pictureName.x = 500;
               pictureName.y = 500;
               pictureName.text = aName;
               addChild(pictureName);
Here is a screenshot of my setup for the font and class.  I also tried the TLF option and that did not make a difference.
Edit: Here are screenshots

Similar Messages

  • ProLoader and TLF TextFields do not work together!

    I'm using ProLoader to load a .swf that uses TLF.  The master .swf loads the target .swf and all code executes as expected with one minor glitch: the content of the loader is white/blank.  Has anyone else seen this!?
    ~~~~~~~~~~~~~~~~~~~~~~~~
    Here is the full bug report that I tried to send Adobe, but they cap reports at 2000 characters and provide no option for uploading a source .zip. (Seriously, Adobe?)  If you have time, and follow my instructions you will see how ProLoader won't even load a .swf with TLF on its stage.  (Yes, I realize this different from my problem, but I'd like to demonostrate how buggy and inconsistent ProLoader is.  The simple solution would be not to use TLF, and mostly likely, I will end up doing that.)
    ******BUG******
    ProLoader loads .swf with TLF, but ProLoader is blank.
    Steps to reproduce bug:
    1.  Download sample files (http://helpx.adobe.com/content/dam/kb/en/141/tn_14190/attachments/Load_External_SWF.zip) from the Tech Note, Load external SWF into another SWF (http://helpx.adobe.com/flash/kb/load-external-swf-swf.html).
    2.  Open ExternalSWF.fla and assign it a document class.
    Here is mine:
    package  {
              import flash.display.MovieClip;
               import flash.events.Event;
              public class ExternalSWF extends MovieClip {
                        public static var DATA_LOAD_COMPLETE:String = "ExternalSWF_DataLoadComplete";
                        private var data_:String;
                        public function ExternalSWF() {}
                        //This function will be called from the .swf that loaded me.
                        public function loadData(data:String):void
                                  data_ = data;
                                  dispatchEvent(new Event(DATA_LOAD_COMPLETE));
                        public function get data():String { return data_; }
    3.  On ExternalSWF.fla's stage, change a classic TextFields into a TLF TextField.
    4.  In Loader_Movie.fla, change all flash.display.Loader instances to fl.display.ProLoader in order to load TLF TextFields.  Also, add an event listener to myLoader for Event.COMPLETE.  Here are my Loader_Movie.fla's Actions:
    import flash.events.Event;
    import fl.display.ProLoader;
    var myLoader:ProLoader = new ProLoader();                     // create a new instance of the ProLoader class
    var url:URLRequest = new URLRequest("ExternalSWF.swf"); // in this case both SWFs are in the same folder
    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, myLoaderIsLoaded);
    myLoader.load(url);                                     // load the SWF file
    addChild(myLoader);                                     // add that instance to the display list, adding it to the Stage at 0,0
    myLoader.x = 10;                                        // move the loaded SWF 10 pixels to the right (from the left edge)  
    myLoader.y = 175;                                       // move the loaded SWF 175 pixels down from the top
    // (optional) load a second external SWF file
    var my2ndLoader:ProLoader = new ProLoader();
    var url2:URLRequest = new URLRequest("ExternalSWF2.swf");
    my2ndLoader.load(url2);
    addChild(my2ndLoader);                                  // optionally, you could put the 2nd SWF beneath
                                                            // the 1st by using addChildAt(my2ndLoader, 1);
    // (optional) scaling of the 2nd SWF file
    my2ndLoader.scaleX = 2;                                 // scale the SWF horizontally by 200%
    my2ndLoader.scaleY = 2;                                 // scale the SWF vertically by 200%
    function myLoaderIsLoaded(event:Event):void
              trace("The first .swf has loaded so add event listeners");
              var swf:ExternalSWF = ExternalSWF(myLoader.content);
              swf.addEventListener(ExternalSWF.DATA_LOAD_COMPLETE, allFinished);
              swf.loadData("foobar");
    function allFinished(event:Event):void
              trace("Here is the data we loaded: " + ExternalSWF(myLoader.content).data);
    Results:
    [Trace] Output
    ReferenceError: Error #1056: Cannot create property __id0_ on ExternalSWF.
              at flash.display::Sprite/constructChildren()
              at flash.display::Sprite()
              at flash.display::MovieClip()
              at ExternalSWF()
    ExternalSWF is invisible; 4 loading dots appear instead.
    Expected results:
    Both .swfs load without incident.
    Trace output:
    The first .swf has loaded so add event listeners
    Here is the data we loaded: foobar
    Additional notes:
    I discovered this bug when my main/master .swf used ProLoader to load another .swf (with TLF on a symbol in the libary).  In this case, the ProLoader appeared blank/white, not even the 4 loading dots.  However, all the code in both .swfs still ran as expected (shown via the Output panel dumping all expected trace statements until execution finished).
    Environment:
    Adobe FLash Professional CS5.5, Version 11.5.1.349
    (bug discovered while running "Test Movie" in IDE)
    Windows 7 Professional Service Pack 1
    Intel(R) Core(TM)2 Duo CPU  E4600 @ 2.40GHz  2.39 GHz
    RAM: 6.00 GB
    64-bit Operating System

    Do you have anything that uses TLF in your preloader? It's possible that the TLF framework has made your preloader so heavy that it merely appears to not be doing anything, but the actual case is that all that stuff has to load before it can show you anything.
    You may find this helpful http://jeffkamerer.com/blog/2010/08/12/using-a-custom-preloader-loop-with-tlf-text/
    However, I don't really understand why you feel you have to use TLF to bring in the text from Photoshop. I think you must mean PhotoShop PSD's, because PhotoShop PNG's will not contain editable text (though Fireworks ones can). I get Photoshop comps all the time and bring the text in as Classic Text. While it's not an exact match 100% of the time, it's as close a match as you're going to get based on the limitations of Classic text. I think there's no reason for your designers to be redoing the designs--you just need to play around with the import settings and figure out what gets you close and then what tweaks you need to do to get closer.
    And, to answer your question, nearly everyone creates graphics for Flash files in Photoshop, despite Fireworks being the better tool. For whatever reason, designers often aren't very adventurous when it comes to learning new tools, and nearly all art schools teach PhotoShop.
    I also don't have any trouble loading CS5.5 AS3 swfs (no TLF--I just don't need the hassle) with Document Classes using an ordinary Loader. So I think there's something not right about what you're doing if you've come to the conclusion that you can't load a swf with a Document Class. Try scaling back to the bare minimum, then working up.
    Finally, I just don't "get" why people do two things that you're doing (or, I do, but I think it's unnecessary and a colossal failure on Adobe's part)
    Instantiating everything through code. Not only are you wasting an inordinate amount of time/code in specifying layout, you also completely lose the natural capability of Flash to compile assets throughout the whole of the swf. This means you have to have a preloader, because literally everything you ever use is embedded before the first visual frame. Contrast to using the timeline, where all you need to load the visuals for the first frame is the Document Class (which you can keep light by coding to Interfaces) and the visuals for the first frame. Anything else you need to load, you can defer to the frame that you've selected for embedding your AS Classes on.
    Using a preloader at all.
    My preloading strategy is very simple. I put a spinner graphic in the first frame, with the word "Loading." The playhead will stop at the frame that I've specified to use for exporting my ActionScript Classes (10--this provides enough space for the label "Loading" to be readable). When the embedded Classes and whatever is needed to display frame 11 is loaded, the playhead will continue to frame 11 by itself, with no code. On Frame 11, I have a MC that is a named instance, and I have a getter/setter pair to catch it. When the setter triggers, I know I'm ready to start the logic.
    However, you could do all sorts of things, like just putting a MC there that "is" the entirety of your other logic (has what is now the Document Class of the swf you're preloading as its BaseClass).
    Anyway, maybe something in my ramble will help you.

  • TextField bounds not working?

    I'm trying to make a simple GUI, it's just in the opening stages here, but my problem is that when the program is run, and the window opens up, the textfield (keyTxt) is the full size of the window... and when I don't add keyTxt, the label's bounds are the full size of the window. I'm not quite sure what I'm doing wrong here, but here's the code:
    import java.awt.*;
    import java.awt.event.*;
    public class KeyWin extends Frame implements ActionListener {   
         public KeyWin () {
              Dimension d = new Dimension(600, 600);
              setSize(d);
              Label keyLbl = new Label("Key:");
              Label actionLbl = new Label ("Action:");
              Label totalLbl = new Label ("Number of tricks:");
              Label setLbl = new Label ("Sets of");
              TextField keyTxt = new TextField ();
              TextField totalTxt = new TextField("####", 4);
              TextField setTxt = new TextField("##", 2);
              this.add(keyLbl);  //added before set bounds as part of troubleshooting.. no luck
              this.add(keyTxt);
              keyLbl.setBounds(5, 5, 8, 5);  //Setting the Bounds here
              keyTxt.setBounds(15, 5, 20, 5);
              setBackground(Color.gray);
              setTitle("Turning Aid - by Visser");
              setVisible(true);
         public void actionPerformed(ActionEvent e) { //I know this won't work yet, have yet to learn closing actions.
              String arg = e.getActionCommand();
              if (arg.equals("Exit")) {
                   this.dispose();
         public static void main (String args[]) { //main function
              KeyWin bleh = new KeyWin();
    }It's probably a simple problem, but wherever I looked in the archives, everyone had done the same here, any help is appreciated :)
    Thanks,
    Visser

    i love Color.gray.yeah, but you better watch out because Color.gray might become deprecated soon, since it's constant, it should be Color.GRAY (String DISCLAIMER = "and if i'm not mistaking again";, then in 1.4 it allready is also GRAY)
    btw: DISCLAIMER + if one sets layout null, then by default components will be layed out from the position 0,0 and with their preferred sizes, if you have on top of the others a lable with no text and with enormous size, then it appears as you had no components...

  • TextField.getCharBoundaries() not working as expected

    Hello. I got an group chat project going on and had a problem with the TextField. The scenario is as follows: there is a public (mass) chat and a privat chats.. Like IRC! The problem is that when someone writes with smilies all appears fine.. until the moment the textfield got full and needs to be scrolled. Then the chat text appears but the getCharBoundaries returns null for the character that is on the last line: e.g. the line that has been just added and is still not scrolled to it.
    Here is a screenshot:
    You can see the after the scroller was scrolled down (and set scroll to maxScroll on TextField), the ":P" is not correctly displayed.
    And here is the reason, according to the trace() message:
         Replace[0] = ":P" @ 394
         r == null @ idx #394/397, found there: ':'
    Where 394 is the index of the smilie and 397 is the total length according to TextField.length property. So the index I request is there for sure.. It's just that getCharBoundaries(394) gives me null. Why?
    http://www.actionscript.org/forums/showthread.php3?p=792090
    I found an "may be" answer but still about to test if that's the problem in my case.. although when I trace the "found there" it appears non new line character... Anyway I would appretiate someone from adobe to comment over this behavior of the TextField.

    Nice workaround dude.. I didn't saw that one
    Though, it's still not a real solution. What I was willing is to have a textfield on the stage and whatever the scroll or size of the textfield to be able to take the boundaries of a character. For instance, just to place the text field and then to get ANY character without stretching around the size of it
    I solved the problem by always scrolling down when new message arrives, but.. that sucks really!
    That's why I cant resize the text field, because then all goes wrong with the scroll and stuff.. I mean if the user had scrolled up a bit and later someone talks in the chat (let's say we talk about group chat), the temp height that I'll assign should be unknown.. althouth I got textHeight and I'm not sure if I can calculate the total height minus the scrolled size... But if I should do all of this there is no point to do it that way.. it's too cheap as performance and my time too.
    Anyway I will appretiate more ideas about that and also I think the subject is interesting to all the guys who wants to create emoticons in their chats right

  • Input Textfields not working in fullscreen mode

    Input Textfields not working in fullscreen mode any one help me.

    Quotes from Adobe:
    "Users cannot enter text in text input fields while in full-screen mode. All keyboard input and key-related ActionScript is disabled while in full-screen mode, with the exception of the keyboard shortcuts that take the viewer out of full-screen mode."
    Check with this article to know more: http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode.html

  • BackSpace not working in textfield

    Hi everybody!
    I have a textfield that only lets enter numeric chars. It extends from JTextField.
    The problem is that the Backspance key is not working. I see that is detected in the processKey Event but it does nothing.
    I have seen some topics about that there is a bug in jdk1.3 and that a solution is using keyTyped instead. But I don't know how to do this.
    May someone help me?
    Thanxxxx

    Hello,
    i think the best way is to to use a custom PlainDocuments for your TextField:
    import javax.swing.*;
    import javax.swing.text.*;
    public class NumberField extends JTextField {
         public NumberField(){
              setDocument(new PlainDocument(){
                   public void insertString(int offset, String str, AttributeSet a)throws BadLocationException{
                        try{
                             Double.parseDouble(str);
                        }catch(NumberFormatException nfe){return;}
                        super.insertString(offset,str,a);
         public static void main(String[] args) {
              JFrame f=new JFrame();
              f.setBounds(0, 0, 100, 50);
              NumberField nf=new NumberField();
              f.getContentPane().add(nf);
              f.setVisible(true);
    }Regards,
    Tim

  • Publishing a flash with AS3.0 on website does not work

    Okay, I'm finally at the end of my flash card. Here's the whole code.
    //import classes
    import com.greensock.TweenLite;
    import com.greensock.easing.*;
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    //end of importing
    //start of sound section is for sound
    var cssLoader:URLLoader;
    var css:StyleSheet;
    var soundReq:URLRequest=new URLRequest("audioFiles/PaukenBrumfiel_AngelsOnHigh.mp3");
    var sound:Sound = new Sound();
    sound.load(soundReq);
    sound.addEventListener(Event.COMPLETE, onComplete);
    //end of sound section
    //Loading external texts
    var weiss:Font = new Weiss();
    var weissBold:Font = new WeissBolder18();
    var weissBolder:Font = new WeissBolder();
    var slideXTween:Tween;
    var txtAlphaTween:Tween;
    var txtNextText:Tween;
    var txtContainer:Sprite;
    var txtField:TextField = new TextField();
    var myTxtField:TextField = new TextField();
    var txtFldwebImages:TextField = new TextField();
    var textRequest:URLRequest=new URLRequest("happyHoliday.txt");
    var textLoad:URLLoader = new URLLoader();
    var txtFormat:TextFormat = new TextFormat();
    var myLinkFormat:TextFormat = new TextFormat();
    var strLink:String;
    var numXPos:Number;
    var numYPos:Number;
    //end of loading external texts
    function onComplete(event:Event):void {
        sound.play();
    function textReady(event:Event):void {
        //txtFormat.font= weiss.fontName;
        txtFormat.color=0x000066;
        txtFormat.size=24;
        //txtField.x = stage.stageWidth;
        //txtField.width = 800;
        txtField.autoSize=TextFieldAutoSize.LEFT;
        //txtField.height = txtField.autoSize
        txtField.wordWrap=false;
        txtField.text=event.target.data;
        txtField.setTextFormat(txtFormat);
        //txtField.y = 350;
        txtField.embedFonts=true;
    textLoad.load(textRequest);
    txtFormat.font= weiss.fontName;
    textLoad.addEventListener(Event.COMPLETE, textReady);
    txtField.x=stage.stageWidth;
    addChild(txtField);
    txtField.y=350;
    TweenLite.to(txtField, 40, {x:-stage.stageWidth*2.25, ease:Linear.easeNone, delay:0.5, onComplete:Inspiration});
    function Inspiration():void {
        txtFormat.font= weissBolder.fontName;
        textLoad.load(new URLRequest("inspiration.txt"));
        txtField.x=130;
        txtField.y=330;
        txtField.alpha=0;
        TweenLite.to(txtField, 5, {alpha:1, onComplete:GoogleFunc});
    function GoogleFunc():void {
        //create and initialize css
        addChild(myTxtField);
        strLink = "<a href='http://www.google.com/' target='_blank'>Google</a>";
        numXPos = 180;
        numYPos = 370;
        var myCSS:StyleSheet = new StyleSheet();
        myCSS.setStyle("a:link", {color:'#000066',textDecoration:'none'});
        myCSS.setStyle("a:hover", {color:'#FF6600',textDecoration:'underline'});
        txtFormat.font = weissBold.fontName;
        //txtFormat.color=0x000066;
        txtFormat.size=20;
        //txtFormat.bold = true;
        myTxtField.setTextFormat(txtFormat);
        myTxtField.defaultTextFormat=txtFormat;
        myTxtField.styleSheet = myCSS; // Linking CSS to TextField
        myTxtField.htmlText="";
        myTxtField.htmlText=strLink;
        myTxtField.wordWrap=false;
        //myTxtField.embedFonts = true;
        myTxtField.width = strLink.length*2;
        myTxtField.x=numXPos;
        myTxtField.y=numYPos;
        //trace("Third txtField.y: " + txtField.y);
        myTxtField.alpha=0;
        TweenLite.to(myTxtField, 1, {alpha:1, onComplete:webImages});
        //trace("tween done");
    function webImages():void {
        addChild(txtFldwebImages);
        var myCSS:StyleSheet = new StyleSheet();
        myCSS.setStyle("a:link", {fontsize:'20',color:'#000066',textDecoration:'none'});
        myCSS.setStyle("a:hover", {fontsize:'20',color:'#FF6600',textDecoration:'underline'});
        txtFormat.font = weissBold.fontName;
        //txtFormat.color=0x000066;
        txtFormat.size=20;
        //txtFormat.bold = true;
        txtFldwebImages.setTextFormat(txtFormat);
        txtFldwebImages.defaultTextFormat=txtFormat;
        txtFldwebImages.styleSheet = myCSS; // Linking CSS to TextField
        txtFldwebImages.htmlText = "";
        txtFldwebImages.htmlText="<a href='http://www.google.com/webImages/' target='_blank'>Google Images</a>";
        txtFldwebImages.wordWrap=false;
        //myTxtField.embedFonts = true;
        txtFldwebImages.width = 300;
        txtFldwebImages.x=300;
        txtFldwebImages.y=370;
        txtFldwebImages.alpha=0;
        TweenLite.to(txtFldwebImages, 1, {alpha:1});
    //end of loading external texts
    Okay, the problem is when I publish the .swf files and put it in an html or .aspx page, it does not work. The audio is not there and a few others things ar enot working. However, it does work if I click on the.html file that Flash created during the publication.
    Here are the folder structions:
    www.mysite.com/myFlashPage.aspx
    www.mysite.com/flashFileFolder/
    www.mysite.com/flashFileFolder/audioFiles/
    So, the myFlashPage.aspx containsthe myFlash.swf file that is inside the flashFileFolder. For some reason, it does not work. Any suggestion is much appreciated.

    The .html file does work if I publish it into the same folder as I created the Flash project. However, when I publish the
    flash .swf to my web site folder (mapped), it's no longer working. The mapped web site drive structher are as follows:
    D:\Mysite\ contains the .html file
    D:\Mysite\flashFileFolder\ contains the .swf file
    D:\Mysite\flashFileFolder\audioFiles contains the PaukenBrumfiel_AngelsOnHigh.mp3 file
    D:\Mysite\flashFileFolder\greensock-tweening-platform-as3 contains all the tweenlite files
    The .html file does not work either. What else do I need to change?

  • Click to URL on RSS text not working on node variable.

    Hi.
    I have a RSS feed parsed into one text box and am using imported CSS to format the text in one Textfield that was created with as3.
    Problem is my roll over and click handler functions for making each text variable a link to the XML URL link will not work unless I point the function at the entire text field. I just want the individual text variables made from the RSS Title nodes, to be set to react to my handleFHTClicked, rollOutHandler and rollOverHandler functions. The movie runs Ok parsing the nodes and picking up the CSS, but I get this error in the output window when it reaches the aformentioned functions...
    TypeError: Error #1006: value is not a function.
         at AS3_CSS_external_file2_fla::MainTimeline/onLoaded()
         at flash.events::EventDispatcher/dispatchEventFunction()
         at flash.events::EventDispatcher/dispatchEvent()
         at flash.net::URLLoader/onComplete()
    Here is the code....
    var cssLoader:URLLoader;
    //load the fake preloader
    var preLoader = new loading_mc();
    preLoader.x = 170;
    preLoader.y = 50;
    preLoader.scaleX = .7;
    preLoader.scaleY = .7;
    addChild(preLoader);
    //This code loads and Parses the RSS feed
    var loader:URLLoader = new URLLoader();
    loader.addEventListener(Event.COMPLETE, onLoaded);
    var dotExtension:String = "...";
    var maxLength:Number = 0;
    var xml:XML;
    function onLoaded(e:Event):void {
         removeChild(preLoader);
         xml = new XML(e.target.data);
         var firstheadtext = xml.channel.item[0].title;
         var firstbodytext = xml.channel.item[0].description;
         var secondheadtext = xml.channel.item[1].title;
         trace(firstheadtext);
         trace(firstbodytext);
         trace(secondheadtext);
         //dtfa.htmlText = "<p align='left'>"+firstheadtext+"</p>"+"</br>"+ "<p align='left'>"+firstbodytext+"</p>";
         var myText:String = "<p>"+firstheadtext+"</p>"
         +"<span class='myTextStyle1'>"+firstbodytext+"</span><br/>"
         +"<br/>"
         +"______________________________________________________________________________<br/>"
         +"<br/>"
         +"<span class='myTextStyle2'>"+secondheadtext+"</span><br/>";
         function cssLoadComplete(event:Event):void {
              var sheet:StyleSheet = new StyleSheet();
              sheet.parseCSS(cssLoader.data);
              myTextField.styleSheet=sheet;
              myTextField.htmlText=myText;
         var myTextField:TextField = new TextField();
         myTextField.width = 500;
         myTextField.height = 240;
         myTextField.multiline = true;
         myTextField.wordWrap = true;
         addChild(myTextField);
         var req:URLRequest = new URLRequest("myStyleSheet.css");
         cssLoader = new URLLoader();
         cssLoader.addEventListener(Event.COMPLETE, cssLoadComplete);
         cssLoader.load(req);
         //This code handels the click through
         firstheadtext.addEventListener(MouseEvent.CLICK, handleFHTClicked);
         function handleFHTClicked(e:MouseEvent):void {
              navigateToURL(new URLRequest(xml.channel.item[0].link));
           firstheadtext.addEventListener(MouseEvent.MOUSE_OVER , rollOverHandler);
           firstheadtext.addEventListener(MouseEvent.MOUSE_OUT, rollOutHandler);
           import flash.text.TextFormat;
              // create the text format objects
              var overTextFormat:TextFormat = new TextFormat();
              overTextFormat.underline = true;
              var defaultTextFormat:TextFormat = new TextFormat();
              defaultTextFormat.underline = false;
         // add the event handlers
              function rollOverHandler(e:MouseEvent):void
               TextField(e.target).setTextFormat(overTextFormat);
              function rollOutHandler(e:MouseEvent):void
              TextField(e.target).setTextFormat(defaultTextFormat);
    loader.load(new URLRequest("http://www.calgaryheraldonline.com/rss_echo.php"));
    Any assistance would be appreciated.
    Cheers
    Forrest

    If I un-nest the functions from the RSS loader, I get many more errors.
    Here is my un-nested code;
    import flash.text.TextFormat;
    var cssLoader:URLLoader;
    //load the fake preloader
    var preLoader = new loading_mc();
    preLoader.x = 170;
    preLoader.y = 50;
    preLoader.scaleX = .7;
    preLoader.scaleY = .7;
    addChild(preLoader);
    //This code loads and Parses the RSS feed
    var loader:URLLoader = new URLLoader();
    loader.addEventListener(Event.COMPLETE, onLoaded);
    var xml:XML;
    function onLoaded(e:Event):void {
         removeChild(preLoader);
         xml = new XML(e.target.data);
         var firstheadtext = xml.channel.item[0].title;
         var firstbodytext = xml.channel.item[0].description;
         var secondheadtext = xml.channel.item[1].title;
         trace(firstheadtext);
         trace(firstbodytext);
         trace(secondheadtext);
         //dtfa.htmlText = "<p align='left'>"+firstheadtext+"</p>"+"</br>"+ "<p align='left'>"+firstbodytext+"</p>";
         var myText:String = "<p>"+firstheadtext+"</p>"
         +"<span class='myTextStyle1'>"+firstbodytext+"</span><br/>"
         +"<br/>"
         +"______________________________________________________________________________<br/>"
         +"<br/>"
         +"<span class='myTextStyle2'>"+secondheadtext+"</span><br/>";
    function handleFHTClicked(e:MouseEvent):void {
         navigateToURL(new URLRequest(xml.channel.item[0].link));
    firstheadtext.addEventListener(MouseEvent.MOUSE_OVER , rollOverHandler);
    firstheadtext.addEventListener(MouseEvent.MOUSE_OUT, rollOutHandler);
    // create the text format objects
    var overTextFormat:TextFormat = new TextFormat();
    overTextFormat.underline = true;
    var defaultTextFormat:TextFormat = new TextFormat();
    defaultTextFormat.underline = false;
    //This code handels the click through
    firstheadtext.addEventListener(MouseEvent.CLICK, handleFHTClicked);
    // add the event handlers
    // you only need these two functions
    function rollOverHandler(e:MouseEvent):void {
         TextField(e.target).setTextFormat(overTextFormat);
    function rollOutHandler(e:MouseEvent):void {
         TextField(e.target).setTextFormat(defaultTextFormat);
    function cssLoadComplete(event:Event):void {
         var sheet:StyleSheet = new StyleSheet();
         sheet.parseCSS(cssLoader.data);
         myTextField.styleSheet=sheet;
         myTextField.htmlText=myText;
    var myTextField:TextField = new TextField();
    myTextField.width = 500;
    myTextField.height = 240;
    myTextField.multiline = true;
    myTextField.wordWrap = true;
    addChild(myTextField);
    var req:URLRequest = new URLRequest("myStyleSheet.css");
    cssLoader = new URLLoader();
    cssLoader.addEventListener(Event.COMPLETE, cssLoadComplete);
    cssLoader.load(req);
    loader.load(new URLRequest("http://www.calgaryheraldonline.com/rss_echo.php"));
    And now the errors are telling me it cannot access the undefined property of myText and firstheadtext.
    I just don't understand what needs to be inside the onLoaded function and what has to be outside.

  • MX:Controls not Work in iphone

    hi friends
    i make simple air application(air2.6 sdk)
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" title="Hello World" >
    <mx:Label text="Hello World! this is Iphone Application" horizontalCenter="0" verticalCenter="0"  fontSize="30"/>
    </mx:WindowedApplication>
    and make a IPA file from adt  command from commandline and install it on iphone and iphone display blank screen only no message display on screen which is on mx:Label />
    and then i make another one
    package{
        import flash.display.Sprite;
        import flash.text.TextField;
        import flash.text.TextFormat;
        import flash.text.TextFieldAutoSize;
        public class HelloWorld extends Sprite
            public function HelloWorld():void
                var textField:TextField = new TextField();
                textField.text = "Hello World!";
                textField.autoSize = TextFieldAutoSize.LEFT;
                var format:TextFormat = new TextFormat();
                format.size = 48;
                textField.setTextFormat ( format );
                this.addChild( textField );
    and then i make another IPA file and install in iphone so this will work perfectly
    so my Question is what is problem with use of <mx:Controls />
    pls help me i have lot's of controls for my iphone app

    hi Ashutosh Sharma
    thnx for your relay
    i follow your instruction and  replace  <WindowedApplication> with <s:MobileApplication>
    now my problem is :
    Error: Could not resolve <s:MobileApplication> to a component implementation.  xmlns:s="library://ns.adobe.com/flex/spark">
    my command line code is :
    >mxmlc +configname=airmobile myfile.mxml
    i'm using 4.5 SDK
    any issue ??? or suggession regarding this
    thnx in adv

  • TextField.setTextFormat() doesn't read indexes in cs5.5

    I have a TLFTextfield, which I've applied a TextFormat to, using a start and end index so it only applies to a range of text.
    Something similar to this:
    var textfield:TLFTextField = new TLFTextField();
    textfield.text = "Some Text";
    textfield.textColor = 0x0000FF;
    addChild(textfield);
    var tf:TextFormat = new TextFormat(null,null,0xFFFF00);
    textfield.setTextFormat(tf,4,6);
    From what I remember in Flash CS5, this works as it should. The text from index 4 to 6 changed to yellow while the rest stays blue.
    This also still works perfect with a normal TextField.
    But in Flash CS5.5, when applying a TextFormat to a TLFTextField, it applies it to the entire TextField, regardless of the startIndex and endIndex on the TextFormat. The whole phrase changes to yellow.
    Has anyone else encountered this?

    I am also having this problem with TLFTextField.setTextFormat() in CS5.5.
    The setTextFormat() beginIndex and endIndex parameters only seem to work with classic TextFields but NOT with TLFTextFields.

  • Binding not working when returning to same page

    Hi, Im developing a portlet that access some data from MYSQL.
    I have a simple page with several textfields, all with bindings to a javabean object that is a property of SessionBean1 bean, so it is a Session Scope bean.
    In that page I put some buttons like next, prior, etc. to navigate between all registers of my DB. I added some code to event button like this:
    public String bnext_action() {
    // get sessionbean
    SessionBean1 SBean1 = (SessionBean1)getBean("SessionBean1");
    // navigate to next register in database
    // ProdBean is my property bean that get values from database
    // bindings are like this : text="#{SessionBean1.prodBean.codigo}
    SBean1.getProdBean().GetNextReg(SBean1.getModuloIdx());
    // set current register index
    SBean1.setModuloIdx(SBean1.getProdBean().getIndex());
    return null;
    The problem is that when I get next register of database, bindings are not reflecting new values, always holding first values. I tried to force things by setting values in pre-rendering face manually with setText method of textfields but nothing happens.
    As Im a newbie in Java yet I really don't undestand this, I have readed all JSF life cycle documention and portlet life cycle docs but couldn't find an answer. Why binding is not working?

    Thanks for this.  Unfortunately now I have tried with Standard actions the links do not work at all.  The links provided were created with spaces so contained within the links are lots of '%20'. e.g. :
    PCI%20DSS/UWE%20PCI-DSS%20Quick%20Reference%20guide.pdf
    for some reason when creating the links with standard actions, when the project is published the links have changed to contain 25s  e.g.
    PCI%2520DSS/UWE%2520PCI-DSS%2520Quick%2520Reference%2520guide.pdf
    no idea why this is happening.

  • Ctrl+tab is not working in editing mode

    I have JcheckBox and JTable in my JPanel. When user clicks or presses F2 to edit any cell value of the JTable a comboBox will appear with possible values. (This comboBox is coming from table CellEditor). When user presses ctrl+tab from the table focus should transfer to JComboBox all time. It is working only when the user presses ctrl+tab from the table cell which is not in editing mode. If the user presses ctrl+tab from the table cell which is in editing mode (i.e. focus is on the ComboBox of the cellEditor) it does not work. Please help me to find the solution.
    I give a sample code here for your reference.
    public class Frame1 extends JFrame {
    public Frame1()
    super();
    this.setLayout( null );
    this.setSize( new Dimension(400, 300) );
    JTextField ch = new JTextField();
    ch.setVisible(true);
    ch.setBounds(10, 10, 10, 10);
    this.add(ch, null);
    DefaultTableModel tmodel = new DefaultTableModel(3, 1);
    tmodel.setValueAt("0 0 1",0,0);
    tmodel.setValueAt("1 0 1",1,0);
    tmodel.setValueAt("2 0 1",2,0);
    JTable custLayersTable = new JTable(tmodel);
    custLayersTable.getColumnModel().getColumn(0).
    setCellEditor(new ComboEditor());
    custLayersTable.setBounds(new Rectangle(40, 40, 280, 145));
    custLayersTable.setSurrendersFocusOnKeystroke(true);
    this.add(custLayersTable, null);
    public static void main(String[] args)
    Frame1 a = new Frame1();
    a.setVisible(true);
    final class ComboEditor extends AbstractCellEditor
    implements TableCellEditor
    public Component getTableCellEditorComponent(JTable table,
    Object value,
    boolean isSelected,
    int row,
    int column)
    Vector<String> layerValSet = new Vector<String>();
    for(int i=0; i<3; i++)
    layerValSet.add(row+" "+column+" "+i);
    mComboModel = new DefaultComboBoxModel(layerValSet);
    mComboModel.setSelectedItem(value);
    mEditorComp = new JComboBox(mComboModel);
    return mEditorComp;
    public Object getCellEditorValue()
    return mEditorComp.getSelectedItem();
    private DefaultComboBoxModel mComboModel;
    private JComboBox mEditorComp;
    }

    Thanks a lot for your reply.
    Since the textField is in a different class i could not use the transferFocus API directly. I tried the following code in the keyreleased event of Combo Box but it was not working.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().focusNextComponent(
    e.getComponent().getParent());
    I also tried the following code in stopCellEditing and is not working.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().focusNextComponent();
    Is there any other way to achieve this?

  • If condtion  not working  in blank text field

    I want that when the text field is blank it should go to the else if portion of the code below:
    JTextField tf1=new JTextField(15);
    if (tf1.getText() != null)
    JOptionPane.showMessageDialog(tf1, "insert value in the range of a-z,A-Z,0-9");
    }                          else if (tf1.getText() == null)
                             System.out.println("fdsafasdfasdfsdf");
    System.out.println("1234");
                                                      JOptionPane.showMessageDialog(tf1,"Enter SmartTextID");
    but control never goes to ==null,even i have initilaized textField with a text then also when i chk with tf1.getText() == "assigned text", its not working.
    plz send me the correct code for this
    thanx..

    if ( textField.getText().trim().equals("") );

  • NetStream.send not working in Flash Player 11.2 Beta with Cirrus, Please confirm if it is a bug

    Title
    NetStream.send not working in Flash Player 11.2 Beta with Cirrus, Please confirm if it is a bug or feature
    Description
    Problem Description:
    NetStream.send can not send data to peerstreams when using with cirrus. Conflict with documents.
    Sorry for tag the build as 11.0.1.3 while the bug is actually on 11.2 beta since the bug report system didn't have 11.2 beta yet.
    If you are not responsible for 11.2 beta bug fix, please help a hand to handle this bug to 11.2 team.
    This bug is "killing" to your application, so we really appreciate your help. Thanks.
    ==Publisher==
    nc.connect("rtmfp://");
    var ns:NetStream = new NetStream(nc, NetStream.DIRECT_CONNECTIONS);
    ns.publish("sendtest");
    ...//after connection success.
    ns.send("clientfunction", "ok"); // this line cannot reach subscribers. even if subscribers have client object correctly.
    ==Subscriber==
    nc.connect("rtmfp://");
    var ns:NetStream = new NetStream(nc, cirrusid);
    var client:Object = new Object();
    client.clientfunction = clientfunction; // target function
    ns.client = client;
    ns.play("sendtest");
    Steps to Reproduce:
    1. compile the code in the attachment to SendTestExample.swf (not be able to paste it here)
    2. run it under flash player 11.2.202.19 beta
    3. run it under flash player 11
    Actual Result:
    HeartBeat is:
    Start HeartBeat:
    send hello
    send hello
    send hello
    which means NetStream.send was not able to call "clientfunction" as expected.
    Expected Result:
    Start HeartBeat:
    send hello
    in client function: hello
    send hello
    in client function: hello
    send hello
    in client function: hello
    which can call into the clientfunction as flash player 11 did.
    Any Workarounds:
    I can not find it out since it's an api level bug. But this can be very important for lots of applications which rely on send to do rpc.
    Test Configuration
    IE8, Firefox under Windows 7
    Also have problem under Windows XP (but not well tested on this platform)
    App Language(s)
    ALL
    OS Language(s)
    ALL
    Platform(s)
    Windows 7
    Browser(s)
    Internet Explorer 8.0
    ==Attachment==
    package {
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.events.NetStatusEvent;
        import flash.events.TimerEvent;
        import flash.media.Video;
        import flash.net.NetConnection;
        import flash.net.NetStream;
        import flash.text.TextField;
        import flash.utils.Timer;
        import flash.utils.setTimeout;
        public class SendTestExample extends Sprite
            public static var statusArea:TextField;
            var ncServer:NetConnection = new NetConnection();
            var nsServer:NetStream;
            var ncClient:NetConnection = new NetConnection();
            var nsClient:NetStream;
            var timer:Timer = new Timer(1000);
            public function SendTestExample() {
                ncServer.addEventListener("netStatus", onNCStatusServer);
                ncServer.connect("rtmfp://p2p.rtmfp.net","99f72ccbed0948d7589dc38a-3ce1b2616680");
                statusArea = new TextField();
                status("status");
                statusArea.x = 0;
                statusArea.y = 0;
                statusArea.border = true;
                statusArea.width = 200;
                statusArea.height = 350;
                addChild(statusArea);
            function onNCStatusServer(event:NetStatusEvent):void {
                status("Step 1:");
                status("server: " + event.info.code);
                status("id: " + ncServer.nearID);
                switch (event.info.code) {
                    case "NetConnection.Connect.Success":
                        nsServer = new NetStream(ncServer, NetStream.DIRECT_CONNECTIONS);
                        nsServer.addEventListener(NetStatusEvent.NET_STATUS, onNSStatusServer);
                        nsServer.publish("sendtest");
                        ncServer.removeEventListener(NetStatusEvent.NET_STATUS, onNCStatusServer);
                        ncClient.connect("rtmfp://p2p.rtmfp.net","99f72ccbed0948d7589dc38a-3ce1b2616680");
                        ncClient.addEventListener("netStatus", onNCStatusClient);
                    case "NetStream.Publish.BadName":
                        //status("Please check the name of the publishing stream" );
                        break;
            function onNCStatusClient(event:NetStatusEvent):void {
                status("Step 2:");
                status("client: " + event.info.code);
                status("id: " + ncClient.nearID);
                switch (event.info.code) {
                    case "NetConnection.Connect.Success":
                        nsClient = new NetStream(ncClient, ncServer.nearID);
                        var c:Object = new Object();
                        c["clientfunction"] = clientfunction;
                        nsClient.client = c;
                        nsClient.play("sendtest");
                        ncClient.removeEventListener(NetStatusEvent.NET_STATUS, onNCStatusClient);
                        //setTimeout(sendHello, 5000);
                    case "NetStream.Publish.BadName":
                        //status("Please check the name of the publishing stream" );
                        break;
            protected function onNSStatusServer(event:NetStatusEvent):void {
                status("nsserver: " + event.info.code);
                if (event.info.code == "NetStream.Play.Start") {
                    status("Start HeartBeat:");
                    this.timer.addEventListener(TimerEvent.TIMER, function (e:Event):void {
                        sendHello();
                    this.timer.start();
            protected function sendHello():void {
                status("send hello");
                nsServer.send("clientfunction", "hello");
            protected function status(msg:String):void
                statusArea.appendText(msg + "\n");
                trace("ScriptDebug: " + msg);
            protected function clientfunction(event:Object):void {
                status("in client function: " + event);

    Thanks for reporting. I can reproduce the bug in house. We will investigate.
    Calise

  • Logout Script not working in 10.9.3 Mavericks

    Sorry for the duplicate post, but this issue is with MacBook Pro not iMac.
    Can anyone tell me why this logoutscript will not work using LogouHook in Mavericks.  The exact same script worked with Lion and Mountain Lion.
    #!/bin/csh
    ## CCS-Checkout Logout Script
    if ( $USER == 'ccs-checkout' ) then
    #first, unlock all files
    /usr/bin/chflags -R nouchg /Users/ccs-checkout/*
    /usr/bin/chflags -R nouchg /Users/ccs-checkout/.Trash/
    /usr/bin/chflags -R nouchg /Users/ccs-checkout/.??*
    #then, delete all of the files
    /bin/rm -R /Users/ccs-checkout
    #copy a "clean" version of the ccs-checkout users home directory
    /usr/bin/ditto -rsrcFork /var/skel/ccs-checkout /Users/ccs-checkout
    #ensure that the users directory exists and set the privs
    /usr/sbin/chown -R ccs-checkout:wheel /Users/ccs-checkout
    /bin/chmod -R 775 /Users/ccs-checkout/
    #make sure trash is empty
    /bin/rm -R /Users/ccs-checkout/.Trash/
    #make sure trash dir exists and set privs for trash and dot files
    /bin/mkdir /Users/ccs-checkout/.Trash
    /usr/sbin/chown -R ccs-checkout /Users/ccs-checkout/.??*
    /bin/chmod -R 700 /Users/ccs-checkout/.??*
    endif
    exit 0
    The script will run in terminal when copied and pasted from #first, unlock all of the files to exit 0.
    When I run defaults write com.apple.loginwindow LogoutHook /usr/local/bin/LogoutScript the date on the com.apple.loginwindow.plist file changes so it is being modified.
    Apparently there is something in:
    #!/bin/csh
    ## CCS-Checkout Logout Script
    if ( $USER == 'ccs-checkout' ) then
    That Mavericks does not like or won't execute.
    To duplicate this issue on your MBP make a user named ccs-checkout with normal permissions and autologon.  After the first logon of the ccs-checkout user log out and log on as root and copy the ccs-checkout users local profile to the /var/skel/ folder.  Then make the above script into an executable .sh file named LogoutScript and place it in the /usr/local/bin/ folder and run the above LogoutHook.
    Thanks for any help with this issue.

    This is the part of code where script fails. In 9.2 I haven't any kind of problems.
                        think(0.1);
                   forms
                   .tree(100,
                        "//forms:tree[(@name='ZVE_PREGLED_ZAVAROVANJE_0')]")
                        .expandNode(
                        "X");
                        think(0.1);
                   forms
                   .tree(101,
                        "//forms:tree[(@name='ZVE_PREGLED_ZAVAROVANJE_0')]")
                        .selectNode(
                        "XY");
                        think(0.1);
                   forms
                   .tree(102,
                        "//forms:tree[(@name='ZVE_PREGLED_ZAVAROVANJE_0')]")
                        .activateNode(
                        "XYZ");
                        think(0.1);
                   forms
                   .textField(103,
                        "//forms:textField[(@name='INFO_BLOCK_IZBRANA_ZAVAROVANJA_0')]")
                        .setFocus();
                        think(0.1);
                   }

Maybe you are looking for

  • Regarding Adhoc Query Creation

    Hi Experts, I am facing issue while creating Adhoc Query in the production Server. After clicking "Save"  button system shows the screen to enter "Package" related details. System shouldn't show this screen in the production server. I want query get

  • Apple Config - can apps be included in the restore point?

    Our school uses Apple Config. for class sets of iPads set up by grade.  Currently they have the restore point set for each grade and includes only the grade specific Apple ID/password.  I'd like to include their common apps too (fully paid for correc

  • What could be causing these strange WiFi networks to show up?

    I have these odd random WiFi networks showing up when I scan for networks to connect to in my house on my MacBook Pro. They don't show up on my iPhone or iPad, just my MacBook Pro. The network named "Gunz" is my home network. The Roku one is a Roku H

  • Solaris 10 with Matlab

    matlab does not work with the latest kernel patches. Why?...

  • [CS4 Server Win]: Plugin does not run on Windows Server 2003?

    Hi, can anybody help? My plugin is running on Windows XP and Windows Vista. On both operation systems the scripting methods are visible in ExtendScript Toolkit and can be called by javascript. On Windows Server 2003 my plugin is not running, the scri