dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Twitter feed not exactly appearing in .swf

  1. #1
    Senior Member
    Join Date
    Jul 2000
    Posts
    373

    Twitter feed not exactly appearing in .swf

    I'm trying to get the last post of a clients' Twitter feed embedded into a dynamic .swf file. I thought I had it and indeed if you go here it works:

    http://204.12.3.54/twitter.swf

    but then I embedded it into the page and now I get the .swf to appear but no feed!

    http://h186498wp.setupmyblog.com/

    It's supposed to connect to a php page that does the work and I'm enclosing it here. I do have crossdomain.xml set up properly. Anyone know why it doesn't connect on my page but it does by itself?

    <?php
    /*
    * @return string
    * @param string $url
    * @desc Return string content from a remote file
    * @author Luiz Miguel Axcar (lmaxcar@yahoo.com.br)
    */

    function get_content($url)
    {
    $ch = curl_init();

    curl_setopt ($ch, CURLOPT_URL, $url);
    curl_setopt ($ch, CURLOPT_HEADER, 0);

    ob_start();

    curl_exec ($ch);
    curl_close ($ch);
    $string = ob_get_contents();

    ob_end_clean();

    return $string;
    }

    #usage:
    $content = get_content ("http://twitter.com/statuses/user_timeline.xml?screen_name=big_pearl");
    echo $content;
    ?>
    Adam Bell
    dzign@datatv.com
    --
    Over 90% of all websites
    suck......
    Join the minority.

  2. #2
    newb of many sorts Ralgoth's Avatar
    Join Date
    Apr 2002
    Posts
    466
    Here's the error that pops when trying to run it on the page...

    Code:
    TypeError: Error #1010: A term is undefined and has no properties.
    	at twitter2_fla::MainTimeline/processXML()
    	at flash.events::EventDispatcher/dispatchEventFunction()
    	at flash.events::EventDispatcher/dispatchEvent()
    	at flash.net::URLLoader/onComplete()
    It looks like a variable is being overlooked in the processXML function. Without seeing your code, I can't help much beyond that.
    Search first, asked questions later.

  3. #3
    Senior Member
    Join Date
    Jul 2000
    Posts
    373

    Yea, I can help you there

    Here's the only AS3 code I'm using on the timeline:

    var myXMLLoader:URLLoader = new URLLoader();
    myXMLLoader.load(new URLRequest("twitter.php"));
    myXMLLoader.addEventListener(Event.COMPLETE, processXML);
    function processXML(e:Event):void {
    var myXML:XML=new XML(e.target.data);
    tweet_1.text=myXML.status[0].text;
    }

    followMe_btn.addEventListener(MouseEvent.CLICK, onFollow);
    function onFollow(e:MouseEvent):void{
    navigateToURL(new URLRequest("http://twitter.com/big_pearl"));
    }

    Obviously, the onFollow function works. It's the processXML function that's the issue.
    Adam Bell
    dzign@datatv.com
    --
    Over 90% of all websites
    suck......
    Join the minority.

  4. #4
    newb of many sorts Ralgoth's Avatar
    Join Date
    Apr 2002
    Posts
    466
    hmmm. It may be a hosting thing actually.

    if you try to access your "twitter.php" on the blog site, you get this message...

    /statuses/user_timeline.xml?screen_name=big_pearl Rate limit exceeded. Clients may not make more than 150 requests per hour.

    Either the Rate limit needs to be lifted, or you'll have to come up with ways to reduce the amount of requests going out.

    in php, you could write the twitter results to a file on the server. Then when a user goes to the site, your "twitter.php" would look and see if the file is >1 minute old. If so, update it, then serve to flash.
    Search first, asked questions later.

  5. #5
    Senior Member
    Join Date
    Jul 2000
    Posts
    373
    Yea, I had a feeling about that. I think it's a Twitter issue where a host can't make so many requests per hour. I guess I'm going to have to try the other solution with the flat file. Hopefully, I can make that work.
    Adam Bell
    dzign@datatv.com
    --
    Over 90% of all websites
    suck......
    Join the minority.

Tags for this Thread

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