PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Error #1009, PHP and I just need help
A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 38

Thread: Error #1009, PHP and I just need help

Hybrid View

  1. #1
    Member
    Join Date
    Jan 2003
    Location
    Ontario
    Posts
    59

    Error #1009, PHP and I just need help

    Okay, so I'm making what I'll refer to as a "race viewer" which will grab data from races that I have run in PHP and is stored in MySQL databases. Now, everything worked just peachy when I had errors in my PHP code but now that I have resolved the errors in my PHP code, I'm getting errors in Flash. It's like every time I think I get somewhere something else stops working.

    My main problem is that I can't debug the stupid thing because it needs to call a php file on my server in order to get the variables in the first place so the debug side of Flash gets snippy about that and freezes if I try to access the settings to allow it. Highly frustrated right now with that.

    Anyhow, here is the error that I'm getting:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at horsego5_fla::MainTimeline/onLoadComplete()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

    This is, from my understanding, referring to the things I have setup to access my data in PHP:

    Actionscript Code:
    var temp:String;
    var myLoader:URLLoader = new URLLoader();
    var myRequest:URLRequest = new URLRequest("http://www.myurlhere.com/doflash.php");
    myRequest.method=URLRequestMethod.POST;
    myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
    myLoader.load(myRequest)
    myLoader.addEventListener(Event.COMPLETE, onLoadComplete)

    The function onLoadComplete then follows and I have never had any issues with the remainder of the script. As I said before, this code worked perfectly fine when I had errors in my PHP code (my imploding wasn't working because I had screwed some stuff up, but now it's all fine). Now my PHP code shows everything perfectly, the only thing I can think that could be causing the problem is the fact that it has to pull in quite a bit of data, but it really doesn't take much longer than a couple of seconds for the PHP file to load but this seems more like an AS issue than loading.

    I also cannot find anywhere in Flash CS4 where I can change my settings for debugging so that it can access the file online. If someone could also point me in the direction of that I would greatly appreciate it.

    Thank you all for your time.

  2. #2
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    well i'm going to help you out first of all we have to get rid of that nasty flash error.......plz post you onLoadComplete function for the loader.....then i will help you debug a URL Loader from the FLASH IDE
    Last edited by calmchess; 06-03-2010 at 09:07 PM.
    ~calmchess~

  3. #3
    Member
    Join Date
    Jan 2003
    Location
    Ontario
    Posts
    59
    Essentially the onLoadComplete function is as follows:

    Actionscript Code:
    function onLoadComplete(e:Event) {
        var loaderVars:URLVariables = new URLVariables(e.target.data);
        var raceid:int = loaderVars.raceid;
        var racelevel:int = loaderVars.racelevel;
        var claimprice1:int = loaderVars.claimprice1;
        var claimprice2:int = loaderVars.claimprice2;
        var purse:int = loaderVars.purse;
        var rundate:String = loaderVars.rundate;
        var stakename:String = loaderVars.stakename;
    }

    There's a bit more to it, but it's just grabbing additional variables and then it calls on the function to start the race itself (which has always worked just fine).

    I understand that in my error I receive I have this line (bolded):

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at horsego5_fla::MainTimeline/onLoadComplete()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

    But I do not see any onComplete anywhere. Everything is onLoadComplete or simply COMPLETE as in the event listener.

  4. #4
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    i meant onComplete generically i'll try to be more specific sorry......anyway i think your variables aren't comeing through execute doflash.php in the browser window and paste what your php echo statment is reporting......use fake input variables in your php if it requires input to run.
    ~calmchess~

  5. #5
    Member
    Join Date
    Jan 2003
    Location
    Ontario
    Posts
    59
    It's very lengthy, so I have been wondering if, perhaps, it's just too much data for Flash to handle? If so, would splitting it into two different loads resolve the problem? As I said before, when there was an error with my imploded arrays it seemed to still grab some of the data, but now that I've fixed the implodes it's not cooperating. But it did cooperate previously with a dummy file, though I added around 12 additional variables.

    Rather than just copy/paste the whole conglomerate here I'll just post the link to the flash file on my site, which echos all of the data:
    http://harnessnation.com/flash/doflash.php

  6. #6
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    claimprice1 has no data.....claimprice2 has no data......these will return null values to flash.

    PHP Code:
    raceid=75771&racelevel=4&claimprice1=&claimprice2=&purse=150000&rundate=2010-04-24&stakename=HarnessNation Trot 
    ~calmchess~

  7. #7
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    your php does seem to be echoing properly out of the twelve additional variables you added are any of them misspelled?
    ~calmchess~

  8. #8
    Member
    Join Date
    Jan 2003
    Location
    Ontario
    Posts
    59
    Thank you for pointing that out. I fixed it but am still receiving the error in Flash.

    Everything else appears to be spelled properly, too.

  9. #9
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    why is an array being echoed?
    PHP Code:

    &horsebreak[1][400]= 
    ~calmchess~

  10. #10
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    ok lets simplify your php and flash i want you to comment out all but two variables in the flash and php file......i just want us to verify that we can receive data....then we will add variables 5 at a time untill we fail then we will know where the problem is at.
    ~calmchess~

  11. #11
    Member
    Join Date
    Jan 2003
    Location
    Ontario
    Posts
    59
    Each array corresponds to each horse (first number) and their position in the race (the second number) and pertains to something in particular such as their time, a predetermined x-position and if they "break stride" in the race (horse term) so that I can provide a realistic reply of the events that took place in the race. Here is my flash code for my arrays, which again, worked perfectly fine with dummy data and have never given me a problem.

    Actionscript Code:
    var timedist:Array = new Array();
        var xpos:Array = new Array();
        var horsebreak:Array = new Array();
            var quarter:Array = new Array();

        temp = loaderVars["quarter"]
        quarter = temp.split("|");

        for(var i:int = 1; i<13; i++)
        {
            temp = loaderVars["timedist["+i+"]"]
            timedist[i] = temp.split("|");
            timedist[i][400] = timedist[i][0];
            timedist[i][800] = timedist[i][1];
            timedist[i][1200] = timedist[i][2];
            timedist[i][1600] = timedist[i][3];
            }

        quarter[400]=quarter[0];
        quarter[800]=quarter[1];
        quarter[1200]=quarter[2];
        quarter[1600]=quarter[3];

    I just included some snippets from the AS since it's redundant to show the entire grouping, but basically, the second number in the array goes up to about 3200 in intervals of 400. All of the arrays (the simple horsename ones or the complex timedist ones) all have the split involved as well and this worked fine with dummy data unless I'm missing something now...

  12. #12
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    ok great but the php data is echoing &horsebreak[1][400]=.....do you need the data from the array or the array representation to be brought into flash?.....lets simplfy like i suggested.....we need to get all the data into flash before we worry about processing it.
    ~calmchess~

  13. #13
    Member
    Join Date
    Jan 2003
    Location
    Ontario
    Posts
    59
    Aha.... so it is the arrays that are giving me a problem here. It's weird that they cooperated with my dummy file in the same format but aren't any longer. What can I do about this?

    I commented out everything and slowly brought back each one and the moment I got to timedist (my first multidimensional array) it returned that error again.

    I need to have all of the data from the array representation and from the array itself. Later in my scripts I have to call on each individual horse in each individual section of the race to see what the value is of certain things. The way I had everything setup before, I was making the assumption that Flash would bring each array in but turn the secondary value to 0 to start instead of going in the 400 intervals that I have setup in the flash page. You can see that in my for loop that I've setup there.

  14. #14
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    i'd echo just the data from the arrays then when it comes into flash i'd push the data into a new array so &horsebreak[1][400]=$whatever would become &horsebreak=$whatever&horsebreakArrIndex = 400 then use this data to create the array.
    ~calmchess~

  15. #15
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    there are more details but this is the basic idea.
    ~calmchess~

  16. #16
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    URLLOADER doen't like special characters is the problem you might find a solution on google that will allow you to send special characters such as []
    ~calmchess~

  17. #17
    Member
    Join Date
    Jan 2003
    Location
    Ontario
    Posts
    59
    I'm not sure I can get away with doing that, though. If they aren't in a multidimensional array in PHP to head into Flash, I'm going to lose a lot of data unless I stop using a loop and manually type in things like $horsebreak1dist400=this, but I can just foresee that being a waste of time if I could otherwise loop everything. I need the multidimensional arrays to differentiate each horse and each distance for each horse.

    I can't really think of another way that could work to bring all of this data over in the format it needs to be in. Why must Flash be so darn picky about everything lol

  18. #18
    Member
    Join Date
    Jan 2003
    Location
    Ontario
    Posts
    59
    Ahhh, interesting! I think I have a gameplan to attack this now so I will give it a try and report back with my success Thank you very much for your help I appreciate it more than you can imagine!!!

  19. #19
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    well i've found the flash data problem the solution to the current problem is up to you.....i'm sure its solveable. want to add me to yahoo messenger and i'll help you work on it?
    ~calmchess~

  20. #20
    Member
    Join Date
    Jan 2003
    Location
    Ontario
    Posts
    59
    I managed to get the variables all over, but now I'm having problems elsewhere that I've never had problems with before lol I swear that Flash just has it out for me, it likes to try and make my life as complicated as possible! Unfortunately, I don't have Yahoo but I appreciate the offer It's getting late for me now so I best give this a rest for the night before I get too frustrated with it.

    Thank you again very much for your help, you have been a life saver and I appreciate it so much!!! Thank you!!

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center