Search Results

Search found 29 results on 2 pages for 'loaderinfo'.

Page 1/2 | 1 2  | Next Page >

  • Error loading Variables stage.loaderInfo - AS3

    - by Dimitree
    I have a Document class that loads variables from Facebook with the use of stage.loaderInfo var connect:FacebookConnectObject = new FacebookConnectObject( facebook, API_KEY, this.stage.loaderInfo ); But when I change the Document class (with another one responsible for the layout of my app), and try call the above from a movieclip that exists in my application with the use: var facebook_class:FacebookAp = new FaceBppkApp addChild(facebook_class) I get error TypeError: Error #1009: Cannot access a property or method of a null object reference. I believe the error comes fro this line this.stage.loaderInfo since I changed the scope... How I am supposed to fix that?

    Read the article

  • loaderInfo null inside creationComplete handler function

    - by Thiago
    Hi, I've coded this small snippet to show what I'm not understanding: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()"> <mx:Script> public function init():void { txtName.text = this.loaderInfo.toString(); } </mx:Script> <mx:TextInput x="50" y="10" id="txtName"/> </mx:Application> I'm getting the following error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Teste/init()[C:\Lucas\flex\AppName\src\Teste.mxml:5] at Teste/___Teste_Application1_creationComplete()[C:\User\flex\CornetaRecorder\src\Teste.mxml:2] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9298] at mx.core::UIComponent/set initialized()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:1169] at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:718] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8628] at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8568] Shouldn't I be able to read loaderInfo inside the creationComplete handler? I'm trying to pass a string from the html to my flash component, that's why I have to get loaderInfo working.

    Read the article

  • this.loaderInfo is null in Flex

    - by Viliam Husár
    I have a problem with Flex module. I want to access url variables by this.loaderInfo.url, i call a function in createionComplete handler of module and sometimes it works and sometimes it doesn't. (Can't access... null). Any suggestions?

    Read the article

  • Anyone else unable to listen to uncaughtErrorEvent when loaded by another swf?

    - by aaaidan
    When I try to access the uncaughtErrorEvents dispatcher when loaded directly, everything works well. But when I try the same code when loaded by another swf I get a reference error. protected function onAddedToStage(e:Event):void { trace("Flash version: " + Capabilities.version); try { loaderInfo.uncaughtErrorEvents.addEventListener("uncaughtError", onUncaughtError); trace("YAY!"); } catch (e:Error) { trace(e); } } Output when loaded directly (in browser): Flash version: MAC 10,1,53,64 YAY! Output when loaded by another "loader" SWF: Flash version: MAC 10,1,53,64 ReferenceError: Error #1069: Property uncaughtErrorEvents not found on flash.display.LoaderInfo and there is no default value. If others can replicate this I'd be appreciative. EDIT: Also have tried this with stage.loaderInfo, instead of just loaderInfo. Same issue...

    Read the article

  • Loading Flash / Flex Applications in another AIR Application

    - by t.stamm
    Hi there, i'm loading a Flex Application in my AIR App and i'm using the childSandboxBridge and parentSandboxBridge to communicate between those two. Works like a charm. But i've tried to load a Flash Application (the main Class extends Sprite, not Application) and therefore i get a SecurityError when trying to set the childSandboxBridge on the loaderInfo object. In the Flex app it's like this: I'm casting the loaderInfo since the childSandboxBridge Property is only available in AIR. loaderInfo = FlexGlobals.topLevelApplication.systemManager.loaderInfo; try { Object(loaderInfo).childSandboxBridge = this; } catch(e:Error) { ... } In my Flash app it's like this: loaderInfo = myMainObject.loaderInfo; // myMainObject is the same class as 'root' try { Object(loaderInfo).childSandboxBridge = this; } catch(e:Error) { ... } In the below example i get the following SecurityError: Error #3206: Caller app:/airapp.swf/[[DYNAMIC]]/1 cannot set LoaderInfo property childSandboxBridge. The SecuritySandbox for both examples is 'application'. Any ideas why it doesn't work with the Flash app? Thanks in advance.

    Read the article

  • 1136: Incorrect number of arguments. Expected 0 AS3 Flash CS5.5 [on hold]

    - by Erick
    how do I solve this error? I've been trying to get the answer online but have not been successful. I'm trying to learn As3 for flash so I decided to try making a preloader for a game. Preloader.as package com.game.moran { import flash.display.LoaderInfo; import flash.display.MovieClip; import flash.events.*; public class ThePreloader extends MovieClip { private var fullWidth:Number; public var ldrInfo:LoaderInfo; public function ThePreloader (fullWidth:Number = 0, ldrInfo:LoaderInfo = null) { this.fullWidth = fullWidth; this.ldrInfo = ldrInfo; addEventListener(Event.ENTER_FRAME, checkLoad); } private function checkLoad (e:Event) : void { if (ldrInfo.bytesLoaded == ldrInfo.bytesTotal && ldrInfo.bytesTotal !=0) { dispatchEvent (new Event ("loadComplete")); phaseOut(); } updateLoader (ldfInfo.bytesLoaded / ldrInfo.bytesTotal); } private function updateLoader(num:Number) : void { mcPreloaderBar.Width = num * fullWidth; } private function phaseOut() : void { removeEventListener (Event.ENTER_FRAME, checkLoad); phaseComplete(); } private function phaseComplete() : void { dispatchEvent (new Event ("preloaderFinished")); } } } Engine.as package com.game.moran { import flash.display.MovieClip; import flash.display.Sprite; import flash.events.Event; public class Engine extends MovieClip { private var preloader:ThePreloader; public function Engine() { preloader = new ThePreloader(732, this.loaderInfo); stage.addChild(preloader); preloader.addEventListener("loadComplete", loadAssets); preloader.addEventListener("preloaderFinished", showSponsors); } private function loadAssets (e:Event) : void { this.play(); } private function showSponsors(e:Event) : void { stage.removeChild(preloader); trace("show sponsors") } } } The line being flagged as an error is line 13 in Engine.as.

    Read the article

  • Flash : Local connection gives error

    - by Fahim Akhter
    I am trying to connect to FBJS bridge. It keeps giving me the following error.When I'm opening only one connection and I do not have any other window open. ArgumentError: Error #2082: Connect failed because the object is already connected. at flash.net::LocalConnection/connect() at BabyVille()[C:\Documents and Settings\user\Desktop\babyville\flash\Main Project\src\BabyVille.as:56] This is my code : public class fbjsTest extends Sprite { private var connection:LocalConnection = new LocalConnection(); private var connectionName:String = LoaderInfo(root.loaderInfo).parameters.fb_local_connection; public function fbjsTest() { connection.connect(connectionName); } } That is on the Facebook page if I try to run it locally the following line returns null LoaderInfo(root.loaderInfo).parameters.fb_local_connection Any Ideas?

    Read the article

  • Flash AS3: (VideoEvent.COMPLETE, completePlay) - listener is triggered before video is completed

    - by Tevi
    Hello, I have a flash video using the standard FLV Playback component that comes with Flash. I'm using ActionScript 3 to modify the appearance and set up an event listener. I've set it up to go to a new URL using "externalInterface" when the video completes play. The URL is set in a variable using SWFObject. On only a few instances (3 people out of 50 - tested using Amazon Turk), people reported being taken directly to the new url, before the video even started playing. It's difficult to repeat the issue, but it did happen to me once. It doesn't have anything to do with cache, since it has been reported on people going to the url for the first time. Here's the url to the video: http://www.partstown.com/is-bin/INTERSHOP.enfinity/WFS/Reedy-PartsTown-Site/en_US/-/USD/ViewStaticPage-UnFramed?page=tourthetown Here's the code: import flash.external.*; import fl.video.*; var myVideo:FLVPlayback = new FLVPlayback(); var theUrl:String = this.loaderInfo.parameters.urlName; var theScript:String = this.loaderInfo.parameters.scriptName; myVideo.source = this.loaderInfo.parameters.videoPath;//"partstown.flv"; myVideo.skin = this.loaderInfo.parameters.skinPath;//"SkinUnderPlayStopSeekMuteVol.swf" myVideo.skinBackgroundColor = 0xAEBEFB; myVideo.skinBackgroundAlpha = 0.5; myVideo.width = 939; myVideo.height = 660; myVideo.addEventListener(VideoEvent.COMPLETE, completePlay); function completePlay(e:VideoEvent):void { myVideo.alpha=0.2; ExternalInterface.call(theScript); } addChild(myVideo); Why would the listener be triggered before the event complete? How can I fix it? Thanks!

    Read the article

  • How to access FlashVars in flash

    - by RBADS
    Hi this is my code in imageload.html http://triangleyoga.com/images/krishna.gif&audio=http://audio.iskcondesiretree.info/02_-_ISKCON_Swamis/His_Holiness_Radhanath_Swami/Bhajans/Hare_Krishna/IDT_70-Hare_Krishna_-_Radhanath_Swami.mp3"/ and in my as3 file i tried to used flashvars as: var params:Object = LoaderInfo(this.root.loaderInfo).parameters; var var1:String = params['img']; trace(var1); But it shows null.Any idea ? Thank you

    Read the article

  • Loading a SWF dynamically causes previously loaded SWFs to misbehave

    - by Aaron
    I have run into a very strange problem with Flash and Flex. It appears that under certain circumstances, movie clips from a SWF loaded at runtime (using Loader) cannot be instantiated if another SWF has been loaded in the mean time. Here is the complete code for a program that reproduces the error. It is compiled using mxmlc, via Ensemble Tofino: package { import flash.display.*; import flash.events.*; import flash.net.*; import flash.system.*; public class DynamicLoading extends Sprite { private var testAppDomain:ApplicationDomain; public function DynamicLoading() { var request:URLRequest = new URLRequest("http://localhost/content/test.swf"); var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onTestLoadComplete); loader.load(request); } private function onTestLoadComplete(e:Event):void { var loaderInfo:LoaderInfo = LoaderInfo(e.target); testAppDomain = loaderInfo.applicationDomain; // To get the error, uncomment these lines... //var request:URLRequest = new URLRequest("http://localhost/content/tiny.swf"); //var loader:Loader = new Loader(); //loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onTinyLoadComplete); //loader.load(request); // ...and comment this one: onTinyLoadComplete(); } private function onTinyLoadComplete(e:Event = null):void { var spriteClass:Class = Class(testAppDomain.getDefinition("TopSymbol")); var sprite:Sprite = Sprite(new spriteClass()); sprite.x = sprite.y = 200; addChild(sprite); } } } With the second loading operation commented out as shown above, the code works. However, if the second loading operation is uncommented and onTinyLoadComplete runs after the second SWF is loaded, the line containing new spriteClass() fails with the following exception: TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@2dc8ba1 to SubSymbol. at flash.display::Sprite/constructChildren() at flash.display::Sprite() at flash.display::MovieClip() at TopSymbol() at DynamicLoading/onTinyLoadComplete()[C:\Users\...\TestFlash\DynamicLoading.as:38] test.swf and tiny.swf were created in Flash CS4. test.swf contains two symbols, both exported for ActionScript, one called TopSymbol and one called SubSymbol. SubSymbol contains a simple graphic (a scribble) and TopSymbol contains a single instance of SubSymbol. tiny.swf contains nothing; it is the result of publishing a new, empty ActionScript 3 project. If I modify test.swf so that SubSymbol is not exported for ActionScript, the error goes away, but in our real project we need the ability to dynamically load sprite classes that contain other, exported sprite classes as children. Any ideas as to what is causing this, or how to fix it?

    Read the article

  • Can you get the size of the Flash object in Actionscript?

    - by futuraprime
    I'm working with a Flash movie and I'm trying to get the size of the player itself (i.e. the height and width Flash has to work with from the object/embed tag). As far as I can tell, Flash doesn't make this available to ActionScript. I'm able to use this.root.loaderInfo.width and this.root.loaderInfo.height to get the "intended" size of the flash movie (what's specified on export), but if the dimensions are different on the page, this isn't helpful.

    Read the article

  • Convert a Relative URL to an Absolute URL in Actionscript / Flex

    - by Bear
    I am working with Flex, and I need to take a relative URL source property and convert it to an absolute URL before loading it. The specific case I am working with involves tweaking SoundEffect's load method. I need to determine if a file will be loaded from the local file system or over the network from looking at the source property, and the easiest way I've found to do this is to generate the absolute URL. I'm having trouble generating the absolute URL for sound effect in particular. Here were my initial thoughts, which haven't worked. Look for the DisplayObject that the Sound Effect targets, and use its loaderInfo property. The target is null when the SoundEffect loads, so this doesn't work. Look at FlexGlobals.topLevelApplication, at the url or loaderInfo properties. Neither of these are set, however. Look at the FlexGlobals.topLevelApplication.systemManager.loaderInfo. This was also not set. The SoundEffect.as code basically boils down to var url:String = "mySound.mp3"; /*>> I'd like to convert the URL to absolute form here and tweak it as necessary <<*/ var req:URLRequest = new URLRequest(url); var loader:Loader = new Loader(); loader.load(req); Does anyone know how to do this? Any help clarifying the rules of how relative urls are resolved for URLRequests in ActionScript would also be much appreciated. edit I would also be perfectly satisfied with some way to tell whether the url will be loaded from the local file system or over the network. Looking at an absolute URL it would just be easy to look at the prefix, like file:// or http://.

    Read the article

  • how to use 3D map Actionscript class in mxml file for display map.

    - by nemade-vipin
    hello friends, I have created the application in which I have to use 3D map Action Script class in mxml file to display a map in form. that is in tab navigator last tab. My ActionScript 3D map class is(FlyingDirections):- package src.SBTSCoreObject { import src.SBTSCoreObject.JSONDecoder; import com.google.maps.InfoWindowOptions; import com.google.maps.LatLng; import com.google.maps.LatLngBounds; import com.google.maps.Map3D; import com.google.maps.MapEvent; import com.google.maps.MapOptions; import com.google.maps.MapType; import com.google.maps.MapUtil; import com.google.maps.View; import com.google.maps.controls.NavigationControl; import com.google.maps.geom.Attitude; import com.google.maps.interfaces.IPolyline; import com.google.maps.overlays.Marker; import com.google.maps.overlays.MarkerOptions; import com.google.maps.services.Directions; import com.google.maps.services.DirectionsEvent; import com.google.maps.services.Route; import flash.display.Bitmap; import flash.display.DisplayObject; import flash.display.DisplayObjectContainer; import flash.display.Loader; import flash.display.LoaderInfo; import flash.display.Sprite; import flash.events.Event; import flash.events.IOErrorEvent; import flash.events.MouseEvent; import flash.events.TimerEvent; import flash.filters.DropShadowFilter; import flash.geom.Point; import flash.net.URLLoader; import flash.net.URLRequest; import flash.net.navigateToURL; import flash.text.TextField; import flash.text.TextFieldAutoSize; import flash.text.TextFormat; import flash.utils.Timer; import flash.utils.getTimer; public class FlyingDirections extends Map3D { /** * Panoramio home page. */ private static const PANORAMIO_HOME:String = "http://www.panoramio.com/"; /** * The icon for the car. */ [Embed("assets/car-icon-24px.png")] private static const Car:Class; /** * The Panoramio icon. */ [Embed("assets/iw_panoramio.png")] private static const PanoramioIcon:Class; /** * We animate a zoom in to the start the route before the car starts * to move. This constant sets the time in seconds over which this * zoom occurs. */ private static const LEAD_IN_DURATION:Number = 3; /** * Duration of the trip in seconds. */ private static const TRIP_DURATION:Number = 40; /** * Constants that define the geometry of the Panoramio image markers. */ private static const BORDER_T:Number = 3; private static const BORDER_L:Number = 10; private static const BORDER_R:Number = 10; private static const BORDER_B:Number = 3; private static const GAP_T:Number = 2; private static const GAP_B:Number = 1; private static const IMAGE_SCALE:Number = 1; /** * Trajectory that the camera follows over time. Each element is an object * containing properties used to generate parameter values for flyTo(..). * fraction = 0 corresponds to the start of the trip; fraction = 1 * correspondsto the end of the trip. */ private var FLY_TRAJECTORY:Array = [ { fraction: 0, zoom: 6, attitude: new Attitude(0, 0, 0) }, { fraction: 0.2, zoom: 8.5, attitude: new Attitude(30, 30, 0) }, { fraction: 0.5, zoom: 9, attitude: new Attitude(30, 40, 0) }, { fraction: 1, zoom: 8, attitude: new Attitude(50, 50, 0) }, { fraction: 1.1, zoom: 8, attitude: new Attitude(130, 50, 0) }, { fraction: 1.2, zoom: 8, attitude: new Attitude(220, 50, 0) }, ]; /** * Number of panaramio photos for which we load data. We&apos;ll select a * subset of these approximately evenly spaced along the route. */ private static const NUM_GEOTAGGED_PHOTOS:int = 50; /** * Number of panaramio photos that we actually show. */ private static const NUM_SHOWN_PHOTOS:int = 7; /** * Scaling between real trip time and animation time. */ private static const SCALE_TIME:Number = 0.001; /** * getTimer() value at the instant that we start the trip. If this is 0 then * we have not yet started the car moving. */ private var startTimer:int = 0; /** * The current route. */ private var route:Route; /** * The polyline for the route. */ private var polyline:IPolyline; /** * The car marker. */ private var marker:Marker; /** * The cumulative duration in seconds over each step in the route. * cumulativeStepDuration[0] is 0; cumulativeStepDuration[1] adds the * duration of step 0; cumulativeStepDuration[2] adds the duration * of step 1; etc. */ private var cumulativeStepDuration:/*Number*/Array = []; /** * The cumulative distance in metres over each vertex in the route polyline. * cumulativeVertexDistance[0] is 0; cumulativeVertexDistance[1] adds the * distance to vertex 1; cumulativeVertexDistance[2] adds the distance to * vertex 2; etc. */ private var cumulativeVertexDistance:Array; /** * Array of photos loaded from Panoramio. This array has the same format as * the &apos;photos&apos; property within the JSON returned by the Panoramio API * (see http://www.panoramio.com/api/), with additional properties added to * individual photo elements to hold the loader structures that fetch * the actual images. */ private var photos:Array = []; /** * Array of polyline vertices, where each element is in world coordinates. * Several computations can be faster if we can use world coordinates * instead of LatLng coordinates. */ private var worldPoly:/*Point*/Array; /** * Whether the start button has been pressed. */ private var startButtonPressed:Boolean = false; /** * Saved event from onDirectionsSuccess call. */ private var directionsSuccessEvent:DirectionsEvent = null; /** * Start button. */ private var startButton:Sprite; /** * Alpha value used for the Panoramio image markers. */ private var markerAlpha:Number = 0; /** * Index of the current driving direction step. Used to update the * info window content each time we progress to a new step. */ private var currentStepIndex:int = -1; /** * The fly directions map constructor. * * @constructor */ public function FlyingDirections() { key="ABQIAAAA7QUChpcnvnmXxsjC7s1fCxQGj0PqsCtxKvarsoS-iqLdqZSKfxTd7Xf-2rEc_PC9o8IsJde80Wnj4g"; super(); addEventListener(MapEvent.MAP_PREINITIALIZE, onMapPreinitialize); addEventListener(MapEvent.MAP_READY, onMapReady); } /** * Handles map preintialize. Initializes the map center and zoom level. * * @param event The map event. */ private function onMapPreinitialize(event:MapEvent):void { setInitOptions(new MapOptions({ center: new LatLng(-26.1, 135.1), zoom: 4, viewMode: View.VIEWMODE_PERSPECTIVE, mapType:MapType.PHYSICAL_MAP_TYPE })); } /** * Handles map ready and looks up directions. * * @param event The map event. */ private function onMapReady(event:MapEvent):void { enableScrollWheelZoom(); enableContinuousZoom(); addControl(new NavigationControl()); // The driving animation will be updated on every frame. addEventListener(Event.ENTER_FRAME, enterFrame); addStartButton(); // We start the directions loading now, so that we&apos;re ready to go when // the user hits the start button. var directions:Directions = new Directions(); directions.addEventListener( DirectionsEvent.DIRECTIONS_SUCCESS, onDirectionsSuccess); directions.addEventListener( DirectionsEvent.DIRECTIONS_FAILURE, onDirectionsFailure); directions.load("48 Pirrama Rd, Pyrmont, NSW to Byron Bay, NSW"); } /** * Adds a big blue start button. */ private function addStartButton():void { startButton = new Sprite(); startButton.buttonMode = true; startButton.addEventListener(MouseEvent.CLICK, onStartClick); startButton.graphics.beginFill(0x1871ce); startButton.graphics.drawRoundRect(0, 0, 150, 100, 10, 10); startButton.graphics.endFill(); var startField:TextField = new TextField(); startField.autoSize = TextFieldAutoSize.LEFT; startField.defaultTextFormat = new TextFormat("_sans", 20, 0xffffff, true); startField.text = "Start!"; startButton.addChild(startField); startField.x = 0.5 * (startButton.width - startField.width); startField.y = 0.5 * (startButton.height - startField.height); startButton.filters = [ new DropShadowFilter() ]; var container:DisplayObjectContainer = getDisplayObject() as DisplayObjectContainer; container.addChild(startButton); startButton.x = 0.5 * (container.width - startButton.width); startButton.y = 0.5 * (container.height - startButton.height); var panoField:TextField = new TextField(); panoField.autoSize = TextFieldAutoSize.LEFT; panoField.defaultTextFormat = new TextFormat("_sans", 11, 0x000000, true); panoField.text = "Photos provided by Panoramio are under the copyright of their owners."; container.addChild(panoField); panoField.x = container.width - panoField.width - 5; panoField.y = 5; } /** * Handles directions success. Starts flying the route if everything * is ready. * * @param event The directions event. */ private function onDirectionsSuccess(event:DirectionsEvent):void { directionsSuccessEvent = event; flyRouteIfReady(); } /** * Handles click on the start button. Starts flying the route if everything * is ready. */ private function onStartClick(event:MouseEvent):void { startButton.removeEventListener(MouseEvent.CLICK, onStartClick); var container:DisplayObjectContainer = getDisplayObject() as DisplayObjectContainer; container.removeChild(startButton); startButtonPressed = true; flyRouteIfReady(); } /** * If we have loaded the directions and the start button has been pressed * start flying the directions route. */ private function flyRouteIfReady():void { if (!directionsSuccessEvent || !startButtonPressed) { return; } var directions:Directions = directionsSuccessEvent.directions; // Extract the route. route = directions.getRoute(0); // Draws the polyline showing the route. polyline = directions.createPolyline(); addOverlay(directions.createPolyline()); // Creates a car marker that is moved along the route. var car:DisplayObject = new Car(); marker = new Marker(route.startGeocode.point, new MarkerOptions({ icon: car, iconOffset: new Point(-car.width / 2, -car.height) })); addOverlay(marker); transformPolyToWorld(); createCumulativeArrays(); // Load Panoramio data for the region covered by the route. loadPanoramioData(directions.bounds); var duration:Number = route.duration; // Start a timer that will trigger the car moving after the lead in time. var leadInTimer:Timer = new Timer(LEAD_IN_DURATION * 1000, 1); leadInTimer.addEventListener(TimerEvent.TIMER, onLeadInDone); leadInTimer.start(); var flyTime:Number = -LEAD_IN_DURATION; // Set up the camera flight trajectory. for each (var flyStep:Object in FLY_TRAJECTORY) { var time:Number = flyStep.fraction * duration; var center:LatLng = latLngAt(time); var scaledTime:Number = time * SCALE_TIME; var zoom:Number = flyStep.zoom; var attitude:Attitude = flyStep.attitude; var elapsed:Number = scaledTime - flyTime; flyTime = scaledTime; flyTo(center, zoom, attitude, elapsed); } } /** * Loads Panoramio data for the route bounds. We load data about more photos * than we need, then select a subset lying along the route. * @param bounds Bounds within which to fetch images. */ private function loadPanoramioData(bounds:LatLngBounds):void { var params:Object = { order: "popularity", set: "full", from: "0", to: NUM_GEOTAGGED_PHOTOS.toString(10), size: "small", minx: bounds.getWest(), miny: bounds.getSouth(), maxx: bounds.getEast(), maxy: bounds.getNorth() }; var loader:URLLoader = new URLLoader(); var request:URLRequest = new URLRequest( "http://www.panoramio.com/map/get_panoramas.php?" + paramsToString(params)); loader.addEventListener(Event.COMPLETE, onPanoramioDataLoaded); loader.addEventListener(IOErrorEvent.IO_ERROR, onPanoramioDataFailed); loader.load(request); } /** * Transforms the route polyline to world coordinates. */ private function transformPolyToWorld():void { var numVertices:int = polyline.getVertexCount(); worldPoly = new Array(numVertices); for (var i:int = 0; i < numVertices; ++i) { var vertex:LatLng = polyline.getVertex(i); worldPoly[i] = fromLatLngToPoint(vertex, 0); } } /** * Returns the time at which the route approaches closest to the * given point. * @param world Point in world coordinates. * @return Route time at which the closest approach occurs. */ private function getTimeOfClosestApproach(world:Point):Number { var minDistSqr:Number = Number.MAX_VALUE; var numVertices:int = worldPoly.length; var x:Number = world.x; var y:Number = world.y; var minVertex:int = 0; for (var i:int = 0; i < numVertices; ++i) { var dx:Number = worldPoly[i].x - x; var dy:Number = worldPoly[i].y - y; var distSqr:Number = dx * dx + dy * dy; if (distSqr < minDistSqr) { minDistSqr = distSqr; minVertex = i; } } return cumulativeVertexDistance[minVertex]; } /** * Returns the array index of the first element that compares greater than * the given value. * @param ordered Ordered array of elements. * @param value Value to use for comparison. * @return Array index of the first element that compares greater than * the given value. */ private function upperBound(ordered:Array, value:Number, first:int=0, last:int=-1):int { if (last < 0) { last = ordered.length; } var count:int = last - first; var index:int; while (count > 0) { var step:int = count >> 1; index = first + step; if (value >= ordered[index]) { first = index + 1; count -= step - 1; } else { count = step; } } return first; } /** * Selects up to a given number of photos approximately evenly spaced along * the route. * @param ordered Array of photos, each of which is an object with * a property &apos;closestTime&apos;. * @param number Number of photos to select. */ private function selectEvenlySpacedPhotos(ordered:Array, number:int):Array { var start:Number = cumulativeVertexDistance[0]; var end:Number = cumulativeVertexDistance[cumulativeVertexDistance.length - 2]; var closestTimes:Array = []; for each (var photo:Object in ordered) { closestTimes.push(photo.closestTime); } var selectedPhotos:Array = []; for (var i:int = 0; i < number; ++i) { var idealTime:Number = start + ((end - start) * (i + 0.5) / number); var index:int = upperBound(closestTimes, idealTime); if (index < 1) { index = 0; } else if (index >= ordered.length) { index = ordered.length - 1; } else { var errorToPrev:Number = Math.abs(idealTime - closestTimes[index - 1]); var errorToNext:Number = Math.abs(idealTime - closestTimes[index]); if (errorToPrev < errorToNext) { --index; } } selectedPhotos.push(ordered[index]); } return selectedPhotos; } /** * Handles completion of loading the Panoramio index data. Selects from the * returned photo indices a subset of those that lie along the route and * initiates load of each of these. * @param event Load completion event. */ private function onPanoramioDataLoaded(event:Event):void { var loader:URLLoader = event.target as URLLoader; var decoder:JSONDecoder = new JSONDecoder(loader.data as String); var allPhotos:Array = decoder.getValue().photos; for each (var photo:Object in allPhotos) { var latLng:LatLng = new LatLng(photo.latitude, photo.longitude); photo.closestTime = getTimeOfClosestApproach(fromLatLngToPoint(latLng, 0)); } allPhotos.sortOn("closestTime", Array.NUMERIC); photos = selectEvenlySpacedPhotos(allPhotos, NUM_SHOWN_PHOTOS); for each (photo in photos) { var photoLoader:Loader = new Loader(); // The images aren&apos;t on panoramio.com: we can&apos;t acquire pixel access // using "new LoaderContext(true)". photoLoader.load( new URLRequest(photo.photo_file_url)); photo.loader = photoLoader; // Save the loader info: we use this to find the original element when // the load completes. photo.loaderInfo = photoLoader.contentLoaderInfo; photoLoader.contentLoaderInfo.addEventListener( Event.COMPLETE, onPhotoLoaded); } } /** * Creates a MouseEvent listener function that will navigate to the given * URL in a new window. * @param url URL to which to navigate. */ private function createOnClickUrlOpener(url:String):Function { return function(event:MouseEvent):void { navigateToURL(new URLRequest(url)); }; } /** * Handles completion of loading an individual Panoramio image. * Adds a custom marker that displays the image. Initially this is made * invisible so that it can be faded in as needed. * @param event Load completion event. */ private function onPhotoLoaded(event:Event):void { var loaderInfo:LoaderInfo = event.target as LoaderInfo; // We need to find which photo element this image corresponds to. for each (var photo:Object in photos) { if (loaderInfo == photo.loaderInfo) { var imageMarker:Sprite = createImageMarker(photo.loader, photo.owner_name, photo.owner_url); var options:MarkerOptions = new MarkerOptions({ icon: imageMarker, hasShadow: true, iconAlignment: MarkerOptions.ALIGN_BOTTOM | MarkerOptions.ALIGN_LEFT }); var latLng:LatLng = new LatLng(photo.latitude, photo.longitude); var marker:Marker = new Marker(latLng, options); photo.marker = marker; addOverlay(marker); // A hack: we add the actual image after the overlay has been added, // which creates the shadow, so that the shadow is valid even if we // don&apos;t have security privileges to generate the shadow from the // image. marker.foreground.visible = false; marker.shadow.alpha = 0; var imageHolder:Sprite = new Sprite(); imageHolder.addChild(photo.loader); imageHolder.buttonMode = true; imageHolder.addEventListener( MouseEvent.CLICK, createOnClickUrlOpener(photo.photo_url)); imageMarker.addChild(imageHolder); return; } } trace("An image was loaded which could not be found in the photo array."); } /** * Creates a custom marker showing an image. */ private function createImageMarker(child:DisplayObject, ownerName:String, ownerUrl:String):Sprite { var content:Sprite = new Sprite(); var panoramioIcon:Bitmap = new PanoramioIcon(); var iconHolder:Sprite = new Sprite(); iconHolder.addChild(panoramioIcon); iconHolder.buttonMode = true; iconHolder.addEventListener(MouseEvent.CLICK, onPanoramioIconClick); panoramioIcon.x = BORDER_L; panoramioIcon.y = BORDER_T; content.addChild(iconHolder); // NOTE: we add the image as a child only after we&apos;ve added the marker // to the map. Currently the API requires this if it&apos;s to generate the // shadow for unprivileged content. // Shrink the image, so that it doesn&apos;t obcure too much screen space. // Ideally, we&apos;d subsample, but we don&apos;t have pixel level access. child.scaleX = IMAGE_SCALE; child.scaleY = IMAGE_SCALE; var imageW:Number = child.width; var imageH:Number = child.height; child.x = BORDER_L + 30; child.y = BORDER_T + iconHolder.height + GAP_T; var authorField:TextField = new TextField(); authorField.autoSize = TextFieldAutoSize.LEFT; authorField.defaultTextFormat = new TextFormat("_sans", 12); authorField.text = "author:"; content.addChild(authorField); authorField.x = BORDER_L; authorField.y = BORDER_T + iconHolder.height + GAP_T + imageH + GAP_B; var ownerField:TextField = new TextField(); ownerField.autoSize = TextFieldAutoSize.LEFT; var textFormat:TextFormat = new TextFormat("_sans", 14, 0x0e5f9a); ownerField.defaultTextFormat = textFormat; ownerField.htmlText = "<a href=\"" + ownerUrl + "\" target=\"_blank\">" + ownerName + "</a>"; content.addChild(ownerField); ownerField.x = BORDER_L + authorField.width; ownerField.y = BORDER_T + iconHolder.height + GAP_T + imageH + GAP_B; var totalW:Number = BORDER_L + Math.max(imageW, ownerField.width + authorField.width) + BORDER_R; var totalH:Number = BORDER_T + iconHolder.height + GAP_T + imageH + GAP_B + ownerField.height + BORDER_B; content.graphics.beginFill(0xffffff); content.graphics.drawRoundRect(0, 0, totalW, totalH, 10, 10); content.graphics.endFill(); var marker:Sprite = new Sprite(); marker.addChild(content); content.x = 30; content.y = 0; marker.graphics.lineStyle(); marker.graphics.beginFill(0xff0000); marker.graphics.drawCircle(0, totalH + 30, 3); marker.graphics.endFill(); marker.graphics.lineStyle(2, 0xffffff); marker.graphics.moveTo(30 + 10, totalH - 10); marker.graphics.lineTo(0, totalH + 30); return marker; } /** * Handles click on the Panoramio icon. */ private function onPanoramioIconClick(event:MouseEvent):void { navigateToURL(new URLRequest(PANORAMIO_HOME)); } /** * Handles failure of a Panoramio image load. */ private function onPanoramioDataFailed(event:IOErrorEvent):void { trace("Load of image failed: " + event); } /** * Returns a string containing cgi query parameters. * @param Associative array mapping query parameter key to value. * @return String containing cgi query parameters. */ private static function paramsToString(params:Object):String { var result:String = ""; var separator:String = ""; for (var key:String in params) { result += separator + encodeURIComponent(key) + "=" + encodeURIComponent(params[key]); separator = "&"; } return result; } /** * Called once the lead-in flight is done. Starts the car driving along * the route and starts a timer to begin fade in of the Panoramio * images in 1.5 seconds. */ private function onLeadInDone(event:Event):void { // Set startTimer non-zero so that the car starts to move. startTimer = getTimer(); // Start a timer that will fade in the Panoramio images. var fadeInTimer:Timer = new Timer(1500, 1); fadeInTimer.addEventListener(TimerEvent.TIMER, onFadeInTimer); fadeInTimer.start(); } /** * Handles the fade in timer&apos;s TIMER event. Sets markerAlpha above zero * which causes the frame enter handler to fade in the markers. */ private function onFadeInTimer(event:Event):void { markerAlpha = 0.01; } /** * The end time of the flight. */ private function get endTime():Number { if (!cumulativeStepDuration || cumulativeStepDuration.length == 0) { return startTimer; } return startTimer + cumulativeStepDuration[cumulativeStepDuration.length - 1]; } /** * Creates the cumulative arrays, cumulativeStepDuration and * cumulativeVertexDistance. */ private function createCumulativeArrays():void { cumulativeStepDuration = new Array(route.numSteps + 1); cumulativeVertexDistance = new Array(polyline.getVertexCount() + 1); var polylineTotal:Number = 0; var total:Number = 0; var numVertices:int = polyline.getVertexCount(); for (var stepIndex:int = 0; stepIndex < route.numSteps; ++stepIndex) { cumulativeStepDuration[stepIndex] = total; total += route.getStep(stepIndex).duration; var startVertex:int = stepIndex >= 0 ? route.getStep(stepIndex).polylineIndex : 0; var endVertex:int = stepIndex < (route.numSteps - 1) ? route.getStep(stepIndex + 1).polylineIndex : numVertices; var duration:Number = route.getStep(stepIndex).duration; var stepVertices:int = endVertex - startVertex; var latLng:LatLng = polyline.getVertex(startVertex); for (var vertex:int = startVertex; vertex < endVertex; ++vertex) { cumulativeVertexDistance[vertex] = polylineTotal; if (vertex < numVertices - 1) { var nextLatLng:LatLng = polyline.getVertex(vertex + 1); polylineTotal += nextLatLng.distanceFrom(latLng); } latLng = nextLatLng; } } cumulativeStepDuration[stepIndex] = total; } /** * Opens the info window above the car icon that details the given * step of the driving directions. * @param stepIndex Index of the current step. */ private function openInfoForStep(stepIndex:int):void { // Sets the content of the info window. var content:String; if (stepIndex >= route.numSteps) { content = "<b>" + route.endGeocode.address + "</b>" + "<br /><br />" + route.summaryHtml; } else { content = "<b>" + stepIndex + ".</b> " + route.getStep(stepIndex).descriptionHtml; } marker.openInfoWindow(new InfoWindowOptions({ contentHTML: content })); } /** * Displays the driving directions step appropriate for the given time. * Opens the info window showing the step instructions each time we * progress to a new step. * @param time Time for which to display the step. */ private function displayStepAt(time:Number):void { var stepIndex:int = upperBound(cumulativeStepDuration, time) - 1; var minStepIndex:int = 0; var maxStepIndex:int = route.numSteps - 1; if (stepIndex >= 0 && stepIndex <= maxStepIndex && currentStepIndex != stepIndex) { openInfoForStep(stepIndex); currentStepIndex = stepIndex; } } /** * Returns the LatLng at which the car should be positioned at the given * time. * @param time Time for which LatLng should be found. * @return LatLng. */ private function latLngAt(time:Number):LatLng { var stepIndex:int = upperBound(cumulativeStepDuration, time) - 1; var minStepIndex:int = 0; var maxStepIndex:int = route.numSteps - 1; if (stepIndex < minStepIndex) { return route.startGeocode.point; } else if (stepIndex > maxStepIndex) { return route.endGeocode.point; } var stepStart:Number = cumulativeStepDuration[stepIndex]; var stepEnd:Number = cumulativeStepDuration[stepIndex + 1]; var stepFraction:Number = (time - stepStart) / (stepEnd - stepStart); var startVertex:int = route.getStep(stepIndex).polylineIndex; var endVertex:int = (stepIndex + 1) < route.numSteps ? route.getStep(stepIndex + 1).polylineIndex : polyline.getVertexCount(); var stepVertices:int = endVertex - startVertex; var stepLeng

    Read the article

  • ArgumentError: Error #2015: Invalid BitmapData.

    - by numerical25
    I am having problems loading a bitmapData. I am getting the following error Engine Init //trace loadimage//trace ArgumentError: Error #2015: Invalid BitmapData. at flash.display::BitmapData() Below is my code. it appears it happens after the trace loadimage package com.objects { import flash.display.Sprite; import flash.display.BitmapData; import flash.display.Bitmap; import flash.geom.Point; import flash.geom.Rectangle; import flash.display.Loader; import flash.net.URLRequest; import flash.net.*; import flash.events.*; import flash.display.LoaderInfo; public class gameObject extends Sprite { protected var w:Number; protected var h:Number; protected var image:BitmapData; protected var canvas:Bitmap; protected var px:Number; protected var py:Number; public function gameObject():void { init(); } private function init():void { } public function loadImage(imageDir:String, w:Number, h:Number, px:Number, py:Number):void { this.w = w; this.y = y; this.px = px; this.py = py; trace("loadimage"); var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,imageComplete); loader.load(new URLRequest(imageDir)); } private function imageComplete(e:Event):void { var loader:LoaderInfo = LoaderInfo(e.target); image = Bitmap(loader.content).bitmapData; drawImage(); } private function drawImage():void { var tilePoint:Point = new Point(0,0); var tileRect = new Rectangle(py,px,w,h); trace(loader.content); var canvasData:BitmapData = new BitmapData(w,h); trace("got canvas data"); canvasData.copyPixels(image,tileRect,tilePoint); trace("copied pixels"); canvas = new Bitmap(canvasData); } } } And my call the the method is like so balls = new Array(); balls[0] = new gameObject(); balls[0].loadImage("com/images/ball.gif", 15,15,0,0); When I trace the Loader.content, below is what shows Engine Init loadimage [object Bitmap] ArgumentError: Error #2015: Invalid BitmapData. at flash.display::BitmapData()

    Read the article

  • Flex secret for session using Facebook API

    - by Mike
    In this video, it mentioned not to embed the Facebook secret key inside the application, http://www.adobe.com/devnet/facebook/articles/video_facebook_quick_start.html, so I passed null to this function facebookSession = new FacebookSessionUtil(MYAPI, null, stage.loaderInfo); but it didn't work. How can I hide my secret key? In the doc it mentioned: http://facebook-actionscript-api.googlecode.com/svn/release/current/docs/com/facebook/utils/FacebookSessionUtil.html secret:String — Your application's secret key. If this parameter is passed a value of null, the constructor looks for a special session secret stored in the fb_sig_ss property of the loaderInfo object. For web sessions, even if you pass a non-null value for this parameter, the constructor will always look for a session secret and use that instead of the value that you pass for this parameter.

    Read the article

  • Preloader stalling flash movie in IE

    - by rogersoli
    This is only a problem in IE. the following actionscript is for a simple preloader for a movie i'm working on. It works fine in Firefox but the movie stops on the first frame when opened with Internet Explorer. Has anyone had this problem before? stop(); addEventListener(Event.ENTER_FRAME,checkLoad); function checkLoad(e:Event):void { var pcent:Number=this.loaderInfo.bytesLoaded /this.loaderInfo.bytesTotal*100; bar_mc.scaleX=pcent/100; loader_txt.text=int(pcent)+"%"; if (pcent==100) { removeEventListener(Event.ENTER_FRAME,checkLoad); this.gotoAndPlay(2); } }

    Read the article

  • How to stop a preloader stalling a flash movie in IE

    - by rogersoli
    This is only a problem in IE. the following actionscript is for a simple preloader for a movie i'm working on. It works fine in Firefox but the movie stops on the first frame when opened with Internet Explorer. Has anyone had this problem before? stop(); addEventListener(Event.ENTER_FRAME,checkLoad); function checkLoad(e:Event):void { var pcent:Number=this.loaderInfo.bytesLoaded /this.loaderInfo.bytesTotal*100; bar_mc.scaleX=pcent/100; loader_txt.text=int(pcent)+"%"; if (pcent==100) { removeEventListener(Event.ENTER_FRAME,checkLoad); this.gotoAndPlay(2); } }

    Read the article

  • Unhandled Status Event (facebook application)

    - by Fahim Akhter
    Hi, I'm getting the following error looked around couldn't find a resultion to it. I'm working on Facebook btw with flash. Warning: AllowScriptAccess='never' found in HTML. This setting is ineffective and deprecated. See http://www.adobe.com/go/allowscriptaccess for details. One of your LocalConnection variables was able to connect say: calling callFBJS a329775198094_sendShoeNumber args ["test"] say: sending to _swf416624 method: asMethod args ["10"] Error #2044: Unhandled StatusEvent:. level=error, code= This is the code I am using: var connection:LocalConnection = new LocalConnection(); var connectionName:String = LoaderInfo(this.root.loaderInfo).parameters.fb_local_connection; // Used to get information from javascript connection.allowDomain("*"); connection.client = { asMethod: function(paramOne:Number) { trace("HAVE RECIEVED SOMETHING : "+paramOne); } }; // To call the javascript function callFBJS(methodName:String, parameters:Array):void { if (connectionNameOne) { connectionOne.send(connectionNameOne, "callFBJS", methodName,parameters); } } callFBJS("sendShoeNumber", ["test"]); connection.addEventListener(StatusEvent.STATUS, testStatus); // Listener for status event function testStatus(event:StatusEvent):void { switch (event.level) { case "status": trace("One of your LocalConnection variables was able to connect"); break; case "error": trace("One of your LocalConnection variables FAILED to connect"); break; } } Have been stuck on this for a while now.

    Read the article

  • How to pass PHP variable as FlashVars via SWFObject

    - by Matt
    I am trying to take a PHP variable and pass it along to Flash via Flash vars. My end goal is to pass a string formatted as XML to Flash, but because I'm struggling I've stripped everything down to the basics. I'm just trying to pass a simple PHP string variable to Flash via FlashVars with SWFObject but something isn't right. The page won't load when I try to pass the variable inside of php tags, but it will load if I just pass a hard coded string. The basic structure of my page is that I have some PHP declared at the top like so: PHP <?php $test = "WTF"; ?> Some HTML (excluded here for simplicity sake) and then the JavaScript SWFObject Embed within my HTML: <script type="text/javascript" src="js/swfobject2.js"></script> <script type="text/javascript"> // <![CDATA[ var swfURL = "swfs/Init-Flash-PHP.swf"; var flashvars = {}; flashvars.theXML = <?php print $test ?>; var params = {}; //params.menu = "false"; params.scale = "showAll"; params.bgcolor = "#000000"; params.salign = "TL"; //params.wmode = "transparent"; params.allowFullScreen = "true"; params.allowScriptAccess = "always"; var attributes = {}; attributes.id = "container"; attributes.name = "container"; swfobject.embedSWF(swfURL, "container", '100%', '100%', "9.0.246", "elements/swfs/expressinstall.swf", flashvars, params, attributes); // ]]> </script> And the bare essentials of the ActionScript 3 Code: _paramObj = LoaderInfo(stage.loaderInfo).parameters; theText_txt.text = _paramObj['theXML']; How do I pass a PHP variable using SWFObject and FlashVars? Thanks.

    Read the article

  • LoaderContext and ApplicationDomain changes with Adobe AIR ?

    - by Tyn
    Hello, I'm currently experimenting with loading external SWF files from both an standard AS3 application, and an AIR application. It seems that the AIR application doesn't act the same way a standard SWF run by the Flash Player does. According to the documentation, the applicationDomain property of LoaderContext is usable in an AIR application too, but it just seems to be not working. I have the following code : package { import flash.display.Loader; import flash.display.LoaderInfo; import flash.display.Sprite; import flash.events.Event; import flash.net.URLRequest; import flash.system.ApplicationDomain; import flash.system.LoaderContext; public class Invoker extends Sprite { private var _ldr : Loader; public function Invoker() { _ldr = new Loader(); _ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onChildOneComplete); var ldrC : LoaderContext = new LoaderContext(false, new ApplicationDomain(ApplicationDomain.currentDomain) ); _ldr.load(new URLRequest("otherSwf.swf"), ldrC); } private function onChildOneComplete(e : Event) : void { var c1ad : ApplicationDomain = (e.target as LoaderInfo).applicationDomain; var inad : ApplicationDomain = ApplicationDomain.currentDomain; trace("Child One parentDomain : " + c1ad.parentDomain); trace("Invoker parentDomain : " + inad.parentDomain); trace("Child One has Invoker : " + c1ad.hasDefinition("Invoker")); trace("Invoker has Invoker : " + inad.hasDefinition("Invoker")); } } } Compiling this code as an SWF file and launching it with the Flash Player does this output, which seems right : Child One parentDomain : [object ApplicationDomain] Invoker parentDomain : null Child One has Invoker : true Invoker has Invoker : true But the same code as an AIR application does a different output : Child One parentDomain : null Invoker parentDomain : null Child One has Invoker : false Invoker has Invoker : true According to the documentation, the first output (using a SWF with Flash Player, and not an AIR application) is the right one. Also, playing around with this snippet and changing the application domain to others possible configurations (like new ApplicationDomain(null), or ApplicationDomain.currentDomain) does exaclty what the documentation says with the SWF, but does not change the output of the AIR application. Any clue why AIR is simply ignoring the application domain passed to the loader context ? Any documentation about this particular issue ? Thank you very much.

    Read the article

  • Flex, Papervision3d: basic scenes, cameras, planes issue

    - by user157880
    // Import Papervision3D import org.papervision3d.Papervision3D; import org.papervision3d.scenes.; import org.papervision3d.cameras.; import org.papervision3d.objects.; import org.papervision3d.materials.; public var scene:Scene3D; public var camera:Camera3D; public var target:DisplayObject3D; public var screenshotArray: Array;//array to store pictures public var radius:Number; public var image:Image; private function initPapervision():void { target= new DisplayObject3D(); camera= new Camera3D(target); 1067: Implicit coercion of a value of type org.papervision3d.objects:DisplayObject3D to an unrelated type Number. scene= new Scene3D(thisContainer); 1137: Incorrect number of arguments. Expected no more than 0. scene.addChild( new DisplayObject3D() , "center" ); } public function handleCreationComplete():void { image = new Image(); image.source = "one_t.jpg"; image.maintainAspectRatio = true; image.scaleContent = false; image.autoLoad = false; image.addEventListener(Event.COMPLETE, handleImageLoad); image.load(); initPapervision(); } public function handleImageLoad(event:Event):void { init3D(); // onEnterFrame addEventListener( Event.ENTER_FRAME, loop3D ); addEventListener( MouseEvent.MOUSE_MOVE , handleMouseMove); } public function init3D():void { addScreenshots(20); } public function handleMouseMove(event:MouseEvent):void { camera.y = Math.max( thisContainer.mouseY*5 , -450 ); } public function addScreenshots(planeCount:Number):void { var obj:DisplayObject3D = scene.getChildByName ("center"); screenshotArray = new Array(planeCount); var texture:BitmapData = new BitmapData(image.content.loaderInfo.width, image.content.loaderInfo.height, false, 0); texture.draw(image); // Create texture with a bitmap from the library var materialSpace :MaterialObject3D = new BitmapMaterial(texture); materialSpace.doubleSided = true; materialSpace.smooth = false; radius = 500; camera.z = radius + 50; camera.y = 50; for (var i:Number = 0; i < planeCount; i++ ) { screenshotArray[i] = new Object() <b>screenshotArray[i].plane = new Plane( materialSpace, 100, 100, 2, 2 );</b> 1180: Call to a possibly undefined method Plane. // Position plane var rotation:Number = (360/planeCount)* i ; var rotationRadians:Number = (rotation-90) * (Math.PI/180); screenshotArray[i].rotation = rotation; screenshotArray[i].plane.z = (radius * Math.cos(rotationRadians) ) * -1; screenshotArray[i].plane.x = radius * Math.sin(rotationRadians) * -1; screenshotArray[i].plane.y = 100; screenshotArray[i].plane.lookAt(obj); // Add to scene scene.addChild( screenshotArray[i].plane ); } <b>scene.renderCamera(camera);</b> <i>1061: Call to a possibly undefined method renderCamera through a reference with static type org.papervision3d.scenes:Scene3D.</i> } public function loop3D(event:Event):void { var obj:DisplayObject3D = scene.getChildByName ("center"); for (var i:Number = 0; i < screenshotArray.length ; i++ ) { var rotation:Number = screenshotArray[i].rotation; rotation += (thisContainer.mouseX/50)/(screenshotArray.length/10); var rotationRadians:Number = (rotation-90) * (Math.PI/180); screenshotArray[i].rotation = rotation; screenshotArray[i].plane.z = (radius * Math.cos(rotationRadians) ) * -1; screenshotArray[i].plane.x = radius * Math.sin(rotationRadians) * -1; screenshotArray[i].plane.lookAt(obj); } //now lets render the scene <b>scene.renderCamera(camera);</b> <i>1061: Call to a possibly undefined method renderCamera through a reference with static type org.papervision3d.scenes:Scene3D.</i> } ]]

    Read the article

  • Loading an external SWF App in a new Air window with resize functionality

    - by t.stamm
    Hello everyone, i'm trying to load a local SWF Application in my Air Application via the SWFLoader class. The SWFLoader class is displayed in a new Window. Therefore, i'm trying to resize the window automatically, when the Flash Application is resizing. But here's the problem. The SWFLoader does not get any events when the loader App has been resized. The Problem seems to be the Sandbox Restrictions. I'm able to call methods in the childSandboxBridge and parentSandboxBridge Objects that i've set in the LoaderInfo of the SWFLoaders content (the loaded SWF Application). But i cannot listen to any ResizeEvents or something like that when i'm resizing the loaded App. I'm aware of the workaround with the Loader Class and the codeExecution Property, but i don't want to bypass the Air Sandbox - if possible. Can anyone help me with this? Thanks in advance

    Read the article

  • AS3 Pass FlashVars to loaded swf

    - by Robin
    Hi I have a A.swf which loads B.swf onto a movieclip and needs to pass it some FlashVars. When loading B.swf with html, I can pass FlashVars fine. When passing from A.swf, it gets a Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: file: The code in A.swf is var request:URLRequest = new URLRequest ("B.swf"); var variables : URLVariables = new URLVariables(); variables.xml = "test.xml"; // This line causes the error 2044, else B.swf loads fine with FlashVars request.data = variables; loader.load (request); In B.swf, it is checking the Flashvars like so. It works fine from html side this.loaderInfo.parameters.xml

    Read the article

  • How can I scale an OSMF player in ActionScript 3/Flex

    - by Greg Hinch
    I am trying to create a simple video player SWF using the open source media framework in Flex 4. I want to make it dynamically scale based on the dimensions of the video, input by the user. I am following the directions on the Adobe help site, but the video does not seem to scale properly. Depending on the size, sometimes videos play larger than the space allotted on the webpage, and sometimes smaller. The only way I have been able to get it to work properly is by including a SWF metadata tag hardcoding the width and height, but I can't use that if I want to make the player dynamically sized. My code is : package { import flash.display.Sprite; import flash.events.Event; import org.osmf.media.MediaElement; import org.osmf.media.MediaPlayer; import org.osmf.media.URLResource; import org.osmf.containers.MediaContainer; import org.osmf.elements.VideoElement; import org.osmf.layout.LayoutMetadata; public class GalleryVideoPlayer extends Sprite { private var videoElement:VideoElement; private var mediaPlayer:MediaPlayer; private var mediaContainer:MediaContainer; private var flashVars:Object; public function GalleryVideoPlayer() { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); flashVars = loaderInfo.parameters; mediaPlayer = new MediaPlayer(); videoElement = new VideoElement(new URLResource(flashVars.file)); mediaContainer = new MediaContainer(); var layoutMetadata:LayoutMetadata = new LayoutMetadata(); layoutMetadata.width = Number(flashVars.width); layoutMetadata.height = Number(flashVars.height); videoElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layoutMetadata); mediaPlayer.media = videoElement; mediaContainer.addMediaElement(videoElement); addChild(mediaContainer); } }}

    Read the article

  • Add something to symbol in dynamicly loaded swf (ActionScript 3)

    - by user1468671
    I have a program written in Flash Builder with Flex 4.6 sdk and swf movie with some symbols inside. Those symbols moving around the stage. What I need is load that swf in my program and replace one of those symbols to my bitmap and show whole swf in flashContainer. There is my code for now: var swfLoader:Loader = new Loader(); var bgUrl:URLRequest = new URLRequest("testMovie.swf"); swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(event: Event) : void { var movie: MovieClip = event.target.content; var headClass: Class = movie.loaderInfo.applicationDomain.getDefinition("headSymbol") as Class; var head:MovieClip = new headClass() as MovieClip; head.addChild(bmp); flashContainer.source = movie; }); but in flashContainer showed old movie. If I do flashContainer.source = head; then only head with my bmp appears. Need help. And sorry for my bad English.

    Read the article

1 2  | Next Page >