Twitter + Papervision3D (using Tweetr)

Tuesday, March 31st, 2009 | examples

Thanks to Tweetr, using Twitter with Flash is extremely simple. This example shows the last tweet with the word “pv3d” in it. So feel free to post to twitter to see your tweet appear :)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package
{
	import com.swfjunkie.tweetr.Tweetr;
	import com.swfjunkie.tweetr.data.objects.SearchResultData;
	import com.swfjunkie.tweetr.events.TweetEvent;
 
	import flash.events.Event;
	import flash.filters.GlowFilter;
 
	import org.papervision3d.materials.special.Letter3DMaterial;
	import org.papervision3d.typography.Text3D;
	import org.papervision3d.typography.fonts.HelveticaBold;
	import org.papervision3d.view.BasicView;
 
	[SWF(width="900", height="480", backgroundColor="#000000", frameRate="31")]
	public class TweetrDemo extends BasicView
	{
		private var text3d:Text3D;
		private var yaw:Number = 0;
 
		public function TweetrDemo()
		{
			super(900, 480);
			opaqueBackground = 0x000000;
 
			var tweetr:Tweetr = new Tweetr();
			tweetr.search("pv3d");
//			tweetr.serviceHost = "http://pv3d.org/twitter/proxy";
 
			tweetr.addEventListener(TweetEvent.COMPLETE, tweetr_completeHandler);
			tweetr.addEventListener(TweetEvent.FAILED, tweetr_failedHandler);
		}
 
		private function tweetr_completeHandler(event:TweetEvent):void
		{
			var searchResultData:SearchResultData = event.responseArray[0] as SearchResultData;
 
			var letterMaterial:Letter3DMaterial = new Letter3DMaterial(0xcc0000);
			letterMaterial.doubleSided = true;
			text3d = new Text3D(searchResultData.text, new HelveticaBold(), letterMaterial);
 
			scene.addChild(text3d); 
 
			startRendering();
 
			viewport.filters = [new GlowFilter(0xffffff, 1, 3, 3, 10, 2)];
		}
 
		private function tweetr_failedHandler(event:TweetEvent):void
		{
			//fail
		}		
 
		override protected function onRenderTick(event:Event=null):void
		{
			text3d.rotationX++;
			camera.orbit(90, yaw++, true, text3d);
			super.onRenderTick(event);
		}
	}
}
  • hi their the comment about the error:

    1172: Definition mx.events:IndexChangedEvent could not be found. in Tweetr.as line 18

    is easily fixed just go into the com.swfjunkie.tweetr.Tweetr.as file and comment out line 18 and all works fine.
  • 1172: Definition mx.events:IndexChangedEvent could not be found. in Tweetr.as line 18??
  • John Lindquist
    @Alexander - Yeah, that can sometimes happen if the twitter search for "pv3d" comes back with characters that aren't included in the font. I didn't put any error handling in there.
  • Alors comme tu voulais, je change la langue. ;-)

    Malheureusement je recois cet alert du Flash Debug Player avec ma version 10:

    TypeError: Error #1009: No se puede acceder a una propiedad o a un método de una referencia a un objeto nulo.
    at org.papervision3d.typography::VectorLetter3D/createVertices()
    at org.papervision3d.typography::VectorLetter3D/getLetterFromFont()
    at org.papervision3d.typography::VectorLetter3D()
    at org.papervision3d.typography::Text3D/createLetters()
    at org.papervision3d.typography::Text3D()
    at TweetrDemo/tweetr_completeHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at com.swfjunkie.tweetr::Tweetr/broadcastTweetEvent()
    at com.swfjunkie.tweetr::Tweetr/handleTweetsLoaded()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

    Salut de Palma de Mallorca, ALEX
  • beautifully simple thank you john. i know you got laid off, i know youre getting back on your feet. id like to thank you for still being MY goto guy for open source. even if i wasnt working with PPV id still come here for cool ideas. CHEERS!
  • dezolo
    hi,
    think you for this example.

    i have a problem with Text3D and Letter3DMaterial, my flex builder don't recognize these classes :
    it says : the org.papervision3d.typography:Text3D definition is not found.

    can you help me wi this please, i want to display a text3D and i can't, because of this problem.

    thx a lot
  • PeZ
    I think, Text3D will really roxx the day extrusion will be added
blog comments powered by Disqus

Search

Recommended Books

Speaking at FITC Toronto

Recent Comments

 

March 2009
M T W T F S S
« Feb   Apr »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Preferred Video Tutorial Resolution

  • 1024x768 (53%, 85 Votes)
  • 1280x1024 (15%, 24 Votes)
  • 1920x1080 (15%, 24 Votes)
  • 800x600 (13%, 20 Votes)
  • 480x320 (4%, 6 Votes)
  • 640x480 (0%, 2 Votes)

Total Voters: 160

Loading ... Loading ...