+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 16 of 16
Like Tree2Likes

Loading external XML files with Flash CS3

This is a discussion on Loading external XML files with Flash CS3 within the Tutorials forums, part of the Flash English category; it still gives me the same error. btw, I tried to start the codes all over, although now im trying ...

  1. #11
    Member Flash Addict gwulfwud is on a distinguished road
    Join Date
    Nov 2007
    Posts
    59
    Rep Power
    6

    Re: Loading external XML files with Flash CS3

    it still gives me the same error.

    btw, I tried to start the codes all over, although now im trying to replicate the one you did for the multiaudio player..

    here' it is...can you check it? thanks man.

    Code:
    package com.externalFiles
    {
        import flash.display.MovieClip;
        import flash.media.Sound;
        import flash.media.SoundChannel;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.events.TimerEvent;
        import flash.net.URLRequest;
        
        public class gwPlayer extends MovieClip
        {        
            private var xml:loadsXML;
            public var object_array:Array;
            public var link_array:Array;
    
            public var totalSong:int;
            
            private var _channel:SoundChannel;
            private var _sound:Sound;
            private var _playing:Boolean;
    
            private var _sposition:int=0;
            private var _songNumber:int=0;
            
            public function gwPlayer()
            {
                initVar();
                initButtons();
                kuhaXML();
            }
        
            public function initVar():void
            {
                object_array=new Array();
                link_array=new Array();
                _playing=false;
            }
            
            private function kuhaXML():void
            {
                xml=new loadsXML(this);
                trace(link_array);
            }
    
            public function initButtons():void
            {
                playSound.addEventListener(MouseEvent.MOUSE_OVER,chPlayImage);
                pauseSound.addEventListener(MouseEvent.MOUSE_OVER,chPauseImage);
                stopSound.addEventListener(MouseEvent.MOUSE_OVER,chStopImage);
                forwardSound.addEventListener(MouseEvent.MOUSE_OVER,chForwardImage);
                
                playSound.addEventListener(MouseEvent.MOUSE_UP,playSong);
                pauseSound.addEventListener(MouseEvent.MOUSE_UP,pauseSong);
                stopSound.addEventListener(MouseEvent.MOUSE_UP,stopSong);
                forwardSound.addEventListener(MouseEvent.MOUSE_UP,forwardSound);
            }
            
            public function chPlayImage(event:Event):void
            {
                trace('Mouse Over PLAY');
            }
            
            public function chPauseImage(event:Event):void
            {
                trace('Mouse Over PAUSE');
            }
            
            public function chStopImage(event:Event):void
            {
                trace('Mouse Over STOP');
            }
            
            public function chForwardImage(event:Event):void
            {
                trace('Mouse Over FORWARD');
            }
    
            public function playSong(event:MouseEvent):void
            {
                if(_playing)
                {
                    //do nothing since it's already playing
                }
                else
                {
                    //_channel.stop();
                    _channel=_sound.play(_sposition);
                    _playing=true;    
                }
            }
    
            public function pauseSong(event:MouseEvent):void
            {
                if(_playing)
                {
                    _sposition=_channel.position;
                    _channel.stop();
                    
                }
                else
                {
                    _channel=_sound.play(_sposition);
                }
                _playing=!_playing;
            }
    
            public function stopSong(event:MouseEvent):void
            {
                _channel.stop();
                _sposition=0;
                _playing=false;
            }
            
            public function forwardSound(event:MouseEvent):void
            {
    
            }
    
            private function initSound(n:Number):void
            {
                _sound=new Sound(new URLRequest(link_array[n]));
                //_sound=new Sound(new URLRequest(url[n]));
                
                _channel=_sound.play();
                _playing=true;
            }
    
        }
    }

  2. #12
    Member Flash Addict gwulfwud is on a distinguished road
    Join Date
    Nov 2007
    Posts
    59
    Rep Power
    6

    Re: Loading external XML files with Flash CS3

    i solved the freaking problem! thank God i started all over.

    btw, the problem is i renamed my filename (different from the name of the class). I changed it to something and made sure they're all the same (including the constructor) and voila! it's fixed...


    got another problem though .... =D

    which i will ask after a few hours of racking my brains on how to solve it.

    thanks!!!

  3. #13
    Member Flash Addict gwulfwud is on a distinguished road
    Join Date
    Nov 2007
    Posts
    59
    Rep Power
    6

    Re: Loading external XML files with Flash CS3

    alright, i really am getting confused..i searched the internet (google) and found a few that explains it but i really can't get the idea...

    this is basically the error im gettting .

    Code:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at com.externalFiles::gwPlayerv2/playSong()
    this happens when i press the play button (playSound)..

    now what they're saying is that because the function does not exist or something like that..

    can someone help please..

  4. #14
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,762
    Rep Power
    11

    Re: Loading external XML files with Flash CS3

    Quote Originally Posted by gwulfwud View Post
    alright, i really am getting confused..i searched the internet (google) and found a few that explains it but i really can't get the idea...

    this is basically the error im gettting .

    Code:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at com.externalFiles::gwPlayerv2/playSong()
    this happens when i press the play button (playSound)..

    now what they're saying is that because the function does not exist or something like that..

    can someone help please..
    It's cause you have _playing not defined.
    Define it:
    Code:
    private var _playing:Boolean=true;

  5. #15
    Member Flash Addict gwulfwud is on a distinguished road
    Join Date
    Nov 2007
    Posts
    59
    Rep Power
    6

    Re: Loading external XML files with Flash CS3

    got it!! thank you sir!

  6. #16
    Junior Member Settled In gege79 is on a distinguished road
    Join Date
    May 2011
    Posts
    1
    Rep Power
    0

    Re: Loading external XML files with Flash CS3

    Hi
    i tried to do this copying your code, but direclty in an empty .fla
    this is code


    import flash.display.Loader;
    import flash.display.MovieClip;
    import flash.events.*;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.xml.*;


    {
    function LoadingXML()
    {
    this.loadXML();
    }
    function loadXML():void
    {
    var loader:URLLoader=new URLLoader();
    loader.addEventListener(Event.COMPLETE,completeHan dler);

    var request:URLRequest=new URLRequest('setting.xml');
    try
    {
    loader.load(request);
    }
    catch(error:Error)
    {
    trace('Unable to load requested document.');
    }
    }
    function completeHandler(event:Event):void
    {
    var loader:URLLoader=URLLoader(event.target);
    var result:XML=new XML(loader.data);
    var myXML:XMLDocument=new XMLDocument();
    myXML.ignoreWhite=true;
    myXML.parseXML(result.toXMLString());
    var node:XMLNode=myXML.firstChild;
    trace('Colore= '+node.firstChild.attributes['color']);
    trace('Nome= '+node.firstChild.attributes['name']);
    trace('Genere= '+node.firstChild.attributes['gen']);
    trace('Età= '+node.firstChild.attributes['age']);
    trace('Path immagine= '+node.firstChild.attributes['picturePath']);

    }
    }


    Then i did the setting.xml
    the output is empty and i've no errors.
    can help me?

+ Reply to Thread
Page 2 of 2 FirstFirst 1 2

Similar Threads

  1. Loading external swf with no use of AS files
    By Flep in forum Actionscript for beginners - tutorials
    Replies: 36
    Last Post: 07-05-11, 18:34
  2. Loading mulitple external .swf files
    By mrentschler in forum Actionscript 3.0 newbies
    Replies: 3
    Last Post: 11-01-11, 03:50
  3. Problems loading external SWF files
    By scott123 in forum Flash English
    Replies: 0
    Last Post: 15-04-10, 15:40
  4. Replies: 1
    Last Post: 26-12-08, 09:42
  5. Help with loading external flash file
    By srivatson in forum HELP free utilities
    Replies: 0
    Last Post: 08-12-08, 12:32

Tags for this Thread

Bookmarks

Posting Permissions

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