Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Page 33 of 45 FirstFirst ... 23313233343543 ... LastLast
Results 481 to 495 of 669

Thread: ActionScript 3 Tip of the Day

  1. #481

    resolved!

    Hi,
    i finally get this code solved!
    Code:
    package  {
        import flash.net.URLRequest;
        import flash.net.URLLoader;
        import flash.events.*;
    
       
        public class loadXML extends EventDispatcher {
            
            public var url:String ;
    
       
            public var myXML:XML;
            
    
            public var total:Number;
            
            private var myLoader:URLLoader;
            
            private var dataWritten:Event;
            
    
            public function loadXML(url) {
                var u = url;
                var rssXMLURL:URLRequest = new URLRequest(u);
                myLoader = new URLLoader(rssXMLURL);
                myLoader.addEventListener("complete", xmlLoaded);
            }
            
    
            public function xmlLoaded(evtObj:Event):void {
                var i = 0;
                var TITLES = [];
                var COPYS = [];
                var LINKS = [];
                myXML = XML(myLoader.data);
                var outXML:XMLList = new XMLList();
                total = myXML.children().length();
                
                trace("as: " + total );
                
                for (i=0; i<total; i++) {
                TITLES[i] = myXML.children().TITLE.children()[i];
                COPYS[i] = myXML.children().COPY.children()[i];
                LINKS[i] = myXML.children().LINK.children()[i];
                
                }
                //this.total = total;
                
                //setTotal(total);
                this.sayHello();
                dataWritten = new Event("dataWritten", true);
                dispatchEvent(dataWritten);
            }
            
            
            public function sayHello():void {
              trace(total + " says hello!");
          }
        
        }
    }
    i also attach the script here.
    thanks for helping me out!
    Quote Originally Posted by johnnyboy View Post
    Hmm, I been messin' round with this small piece of code for an hour now, but there is no way it's working.

    I'm on a MacBook Pro with Flash CS3 Pro, but the MOUSE_LEAVE events does not get fired no matter what I do.

    Anybody having the same probs as me, or did I miss something??
    Attached Files Attached Files

  2. #482
    in regards to replacing the global space, what do you think about using a singleton rather than a class filled with static properties/methods?

    i remember singletons being pushed. perhaps it was a professor...

    actually the only real benefit i can remember is that if one wants to turn a singleton class into a normally instantiated class, it's not as much refactoring...

  3. #483

    type coercion still failed

    So I've overridden the clone method for my custom event and it still didn't work. Maybe because the event is dispatched from a loaded swf? If my event handler expects a normal event it won't cause an error (handleEvent(e:Event)), but if the event handler expects a custom event (handleEvent(e:CustomEvent) it will give a type coercion error. I have no idea why but i think it's because it's in a loaded swf. If the event handler is in the same swf where the event was dispatched i can handle the custom event. Anyone have any ideas?

  4. #484
    damn. wrong thread.

  5. #485
    maybe string distinguishing events is the same as native one

  6. #486

    LOL

    LOL

    WBR,
    Alex

  7. #487

    TextField Problem

    Hello, I need some help, im trying to drag and rotate a textfield in AS 3.0, Can its possible?, Im so new in this . Thanks!!!

  8. #488
    to rotate a textField u must embed font displayed in it

  9. #489
    I need input text in it and drag to rotate , but doesnt work , I need put that into moviveclip? or exist other way?
    Thanks!!!

  10. #490
    U don't have to use another MovieClip to rotate (texField extends DisplayObject), but to use startDrag() method u could put it inside a Sprite or just change its x and y values on MouseMove Event

  11. #491

    What about the actual URL?

    Quote Originally Posted by senocular View Post
    The URLLoader class (flash.net.URLLoader) in ActionScript 3 is used to load content from an external text file. When an external file has been loaded, its contents are stored within the data property of the URLLoader instance. Normally, the contents of a file, no matter what the file is, is loaded in as raw text. If you want the contents of a file to be loaded as variables (i.e. the loaded file is a text file whose contents consist of URL-encoded variables) then you will want to change the dataFormat property of the URLLoader.

    The dataFormat property determines the format of the data being loaded into the URLLoader. Values for dataFormat are contained within the URLLoaderDataFormat class (flash.net.URLLoaderDataFormat). Possible values include:
    • BINARY - Specifies that downloaded data is received as raw binary data.
    • TEXT - Specifies that downloaded data is received as text.
    • VARIABLES - Specifies that downloaded data is received as URL-encoded variables.
    Using URLLoaderDataFormat.VARIABLES for the URLLoader's dataFormat, the loaded data will come in as a collection of variables instead of a string. The value of the data property will then be a URLVariables class (flash.net.URLVariables) instance whose properties consist of the variables loaded.

    ActionScript Code:
    var loader:URLLoader = new URLLoader();

    // specify format as being variables
    loader.dataFormat = URLLoaderDataFormat.VARIABLES;

    loader.addEventListener(Event.COMPLETE, varsLoaded);

    // vars.txt contents: foo=bar&foo2=bar2
    loader.load(new URLRequest("vars.txt"));

    function varsLoaded (event:Event):void {
    &nbsp;&nbsp;&nbsp;&nbsp;trace(loader.data is URLVariables); // true
    &nbsp;&nbsp;&nbsp;&nbsp;trace(loader.data.foo); // bar
    &nbsp;&nbsp;&nbsp;&nbsp;trace(loader.data.foo2); // bar2
    }




    Thanks for the great info on pulling variables into flash in the URL format. I'm a little confused though. Say you wanted to pull the variables from the very URL of the page that loaded the flash document, not an outside file. How would you pull them from that?

    Thanks,
    Aaron

  12. #492
    1
    posts
    Registered User

    Thanks.....!!

    very good idea....

  13. #493

    I'm new to AS3

    Hello everyone, I'm a new member to this site and new in Actionscript 3 as well. I was wondring if anyone could give me an advise on where to start from because i do not have any knowledge on AS3.

    Thanks
    ryan

  14. #494
    Spam attack! Moderator - delete this post also when you delete the spam.

  15. #495
    Hi senocular,

    my issue is related with XML in AS3. i m currently working on xmlsocket connection with AS3. but just to make my question simple, i want to create an XML with AS3 which should not have been foramted with linesapces. like if u trace an XML in AS3 it will be like this:
    [
    <mainNode>
    <childNode>
    <otherchildNode />
    </childNode>
    </mainNode>
    ]

    But i want this XML showing no line spaces like this:
    <mainNode><childNode><otherchildNode /></childNode></mainNode>

    How is it Possible ?

Page 33 of 45 FirstFirst ... 23313233343543 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012