<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc = "http://purl.org/dc/elements/1.1/" xmlns="http://purl.org/rss/1.0/">
	<channel rdf:about="http://livedocs.adobe.com/">
	<title>LiveDocs Comments - flash - 9.0 - main - 00000171.html</title>	
		<link>http://livedocs.adobe.com/</link>
		<description>Macromedia LiveDocs - online documentation with user feedback.</description>
		<copyright>Copyright 2009, Macromedia, Inc.</copyright>
		<dc:date>2009-11-25T12:31:29</dc:date>
		<dc:language>en-us</dc:language>
		<items>
			<rdf:Seq>
				<rdf:li rdf:resource="http://livedocs.adobe.com/flash/9.0/main/00000171.html#81084" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/flash/9.0/main/00000171.html#79340" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/flash/9.0/main/00000171.html#78014" />
			</rdf:Seq>
		</items>
	</channel>
	
	<item rdf:about="http://livedocs.adobe.com/flash/9.0/main/00000171.html#81084">
		<title>flash/9.0/main/00000171.html</title>
		<link>http://livedocs.adobe.com/flash/9.0/main/00000171.html#81084</link>
		<description>The example is wrong only if you try putting it in a package. You can only access the image data from the loader's content property if you allow the loader to be available throughout the class. &lt;br /&gt;&lt;br /&gt;In the example, the function imgLoaded can call upon the variable pictLoader because that variable was instantiated at a higher level (the document level as opposed to the function level).&lt;br /&gt;&lt;br /&gt;For the example to work in a package, it should look something like this:&lt;br /&gt;&lt;br /&gt;package&lt;br /&gt;{&lt;br /&gt;  import flash.display.*;&lt;br /&gt;  import flash.net.URLRequest;&lt;br /&gt;  import flash.events.*;&lt;br /&gt;&lt;br /&gt;  public class LoaderExample extends Sprite&lt;br /&gt;  {&lt;br /&gt;    var pictLdr:Loader = new Loader(); // Placed outside of any function&lt;br /&gt;    var container:Sprite = new Sprite(); // Same here&lt;br /&gt;&lt;br /&gt;    public function LoaderExample()&lt;br /&gt;    {&lt;br /&gt;    addChild(container);&lt;br /&gt;    var pictURL:String = &quot;banana.jpg&quot;&lt;br /&gt;    var pictURLReq:URLRequest = new URLRequest(pictURL);&lt;br /&gt;    pictLdr.load(pictURLReq); // Accessed from THIS function....&lt;br /&gt;    pictLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded); &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    function imgLoaded(event:Event):void&lt;br /&gt;    {&lt;br /&gt;         container.addChild(pictLdr.content); // ...and THIS function as well&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;You can't call a variable that's in one function from a different function (unless you mess with the access control modifier of the variable). In other words, if you want to access a variable from multiple functions, that variable must be placed at the class level.</description>
		<dc:creator>vonWolfenhaus</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2008-02-24T21:30:23</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/flash/9.0/main/00000171.html#79340">
		<title>flash/9.0/main/00000171.html</title>
		<link>http://livedocs.adobe.com/flash/9.0/main/00000171.html#79340</link>
		<description>The example is not wrong. Either method works for me. You can access the image from the loader's content property or the event.target's content property.&lt;br /&gt;- Vinny</description>
		<dc:creator>vinnyguido</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2008-01-09T09:20:42</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/flash/9.0/main/00000171.html#78014">
		<title>flash/9.0/main/00000171.html</title>
		<link>http://livedocs.adobe.com/flash/9.0/main/00000171.html#78014</link>
		<description>The example is incorrect ..&lt;br /&gt;The correct function should be:&lt;br /&gt;function imgLoaded(event:Event):void&lt;br /&gt;{&lt;br /&gt;    container.addChild(event.target.content);   //THIS LINE WAS WRONG&lt;br /&gt;}</description>
		<dc:creator>philggg</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2007-12-05T18:32:50</dc:date>
	</item>
	</rdf:RDF>

