Search Results

Search found 195 results on 8 pages for 'urlrequest'.

Page 5/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • I am trying to add a link on an Image

    - by firemonkey
    Hi, I am trying to add a link to an image using ActionScript. I do not see the link no matter what. Below is my code, Can you please suggest what am I doing wrong. <?xml version="1.0" encoding="utf-8"?> <mx:Application creationComplete="application1_creationCompleteHandler(event)" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600"> <mx:Script> <![CDATA[ import mx.controls.Button; import mx.controls.Image; import mx.events.FlexEvent; protected function application1_creationCompleteHandler(event:FlexEvent):void { var but:Button = new Button(); but.label = "BUT"; uic.addChild(but); var dollLoader:Loader=new Loader(); dollLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dollCompleteHandler); var dollRequest:URLRequest = new URLRequest("http://www.google.com/intl/en_ALL/images/logo.gif"); dollLoader.load(dollRequest); uic.addChild(dollLoader); } private function dollCompleteHandler(event:Event):void { } ]]> </mx:Script> <mx:UIComponent id="uic" width="100%" height="100%"> </mx:UIComponent> </mx:Application>

    Read the article

  • Load images into separate movie clips from a XML, Flash, Actionscript 3.0

    - by James Dunay
    I have an xml image bank, pretty standard, and I have a loader, along with movie clips that I want the images loaded into, the problem that I am running into is I want the images to load into separate movie clips, so I’m using a case statement to specify where they go. However, I can only get them to load into a single movie clip, I assume they are loading ontop of each other and I don’t know how to get them to separate out. I’ll post my code. It doesn’t make any sense to me but if you have any suggestions that would be real great. I can make separate loaders and then just do 1 image per loader, but that just doesn’t sound right to me. var counterNumber:Number = 0; function callThumbs():void{ for (var i:Number = 0; i <3; i++){ thumbLoaded(); counterNumber++; } } function thumbLoaded(){ var photoLoader = new Loader(); switch (counterNumber){ case 1: photoLoader.load(new URLRequest(MovieClip(this.parent).xml.photos.imageOne.image.@url[0])); whole.boxOne.pictureLoader.addChild(photoLoader); trace("1Done"); break; case 2: photoLoader.load(new URLRequest(MovieClip(this.parent).xml.photos.imageTwo.image.@url[0])); whole.boxTwo.pictureLoader.addChild(photoLoader); trace("2Done"); break; } }

    Read the article

  • [AS3] Calling Php Script with UTF-8 POST variables

    - by kornelijepetak
    AS3 documentation says that Strings in AS3 are in UTF-16 format. There is a textbox on a Flash Clip where user can type some data. When a button is clicked, I want this data to be sent to a php script. I have everything set up, but it seems that the PHP script gets the data in UTF-16 format. The data in the database (which is utf-8) shows some unrecognizable characters (where special characters are used), meaning that the data has not been sent in a correct encoding. var variables:URLVariables=new URLVariables; var varSend:URLRequest=new URLRequest("http://website.com/systematic/accept.php"); varSend.method=URLRequestMethod.POST; varSend.data=variables; var varLoader:URLLoader=new URLLoader; varLoader.dataFormat=URLLoaderDataFormat.VARIABLES; varLoader.addEventListener(Event.COMPLETE, completeHandler); When submit button is clicked, the following handler gets executed. function sendData(event:MouseEvent) : void { // i guess here is the problem (tbName.text is UTF-16) variables.name = tbName.text; varLoader.load(varSend); } Is there any way to send the data so that PHP script gets the data in UTF-8 format? (PHP script is retrieving the value using the $_POST['name']).

    Read the article

  • Resizing FileReference image then reuploading, only reuploads original image.

    - by pfunc
    I can;t figure out how to do this. Someone selects and image after calling FileReference.browse(). I take that image and make a thumbnail in flash. Then I upload that image like so: var newFileReq:URLRequest = new URLRequest(FILE_UPLOAD_TEMP); newFileReq.contentType = "application/octet-stream"; var fileReqVars:URLVariables = new URLVariables(); fileReqVars.image = myThumbImage; fileReqVars.folder = "Thumbs"; newFileReq.data = fileReqVars; newFileReq.method = URLRequestMethod.POST; //upload the first image fileRef.addEventListener(Event.COMPLETE, onFirstFileUp); fileRef.upload(newFileReq, "Filedata"); All this does it upload the original image. How do I change the fileRef to upload the new thumb? I have traced out the size of the "myThumbImage" and it is correct. I have placed it visually on the stage after creating the thumb, and it seems like it works. But when I upload it to an aspx page (that basically just throws it into a folder), it uploads the original larger image.

    Read the article

  • Flash AS3: How to Make scroll bar react to dynamic textfield movement?

    - by HeroicNate
    I've been looking for a tutorial and answer to this for a while but can't find what I'm looking for. I am loading html text into a dynamic textfield, and I have a scrollbar controlling the scroll using the code below. What I want to do is also add scroll up/down buttons and have the scroll bar move in relation to the text scroll. I was just going to use "tracklistingtext.scrollV -- " for the scroll buttons, but right now the scroll bar doesn't recognize the text movement. What do I need to do to get the scroll bar to listen to the text scroll position? var listTextreq:URLRequest=new URLRequest("tracklist.txt"); var listTextLoader:URLLoader = new URLLoader(); var bounds:Rectangle=new Rectangle(scrollMC.x,scrollMC.y,0,300); var scrolling:Boolean=false; function fileLoaded(event:Event):void { tracklistingtext.htmlText=listTextLoader.data; tracklistingtext.multiline=true; tracklistingtext.wordWrap=true; scrollMC.addEventListener(MouseEvent.MOUSE_DOWN, startScroll); stage.addEventListener(MouseEvent.MOUSE_UP, stopScroll); addEventListener (Event.ENTER_FRAME, enterHandler); } listTextLoader.addEventListener(Event.COMPLETE, fileLoaded); listTextLoader.load(listTextreq); function startScroll(e:Event):void { scrolling=true; scrollMC.startDrag(false,bounds); } function stopScroll(e:Event):void { scrolling=false; scrollMC.stopDrag(); } function enterHandler (e:Event):void { if (scrolling == true) { tracklistingtext.scrollV = Math.round(((scrollMC.y - bounds.y)/300)*tracklistingtext.maxScrollV); } } Any help is greatly appreciated.

    Read the article

  • initWithContentsOfURL seems to have issues with "long" URLs

    - by samsam
    Hi there I'm facing a rather strange Issue when trying to load data from an XML-Webservice. The webservice allows me to pass separated identifiers within the URL-Request. It is therefore possible for the URL to become rather long (240 characters). If I open said URL in firefox the response arrives as planned, if I execute the following code xmlData remains empty. NSString *baseUrl = [[NSString alloc] initWithString:[[[[kSearchDateTimeRequestTV stringByReplacingOccurrencesOfString:@"{LANG}" withString:appLanguageCode] stringByReplacingOccurrencesOfString:@"{IDENTIFIERS}" withString:myIdentifiers] stringByReplacingOccurrencesOfString:@"{STARTTICKS}" withString:[NSString stringWithFormat:@"%@", [[startTime getTicks] descriptionWithLocale:nil]]] stringByReplacingOccurrencesOfString:@"{ENDTICKS}" withString:[NSString stringWithFormat:@"%@", [[endTime getTicks] descriptionWithLocale:nil]]]]; NSLog(baseUrl); //looks good, if openend in browser, returnvalue is ok urlRequest = [NSURL URLWithString:baseUrl]; NSString *xmlData = [NSString stringWithContentsOfURL:urlRequest encoding:NSUTF8StringEncoding error:&err]; //err is nil, therefore i guess everything must be ok... :( NSLog(xmlData); //nothing... is there any sort of URL-Length restriction, does the same problem happened to anyone of you as well? whats a good workaround? thanks for your help sam

    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

  • JSON to display text -- Freezes UI

    - by Adam Storr
    Hi everyone, I currently have a very simple view which displays info from a JSON feed. The problem I'm facing is the few second pause I encounter once I press this tab. How can I make this view load instantly and then have the label.text areas load after? Preferable with an activity indicator? Should I use threads? Thanks in advance! Code: - (NSString *)stringWithUrl:(NSURL *)url { NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadRevalidatingCacheData timeoutInterval:30]; NSData *urlData; NSURLResponse *response; NSError *error; urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&error]; return [[NSString alloc] initWithData:urlData encoding:NSUTF8StringEncoding]; } - (id)objectWithUrl:(NSURL *)url { SBJsonParser *jsonParser = [SBJsonParser new]; NSString *jsonString = [self stringWithUrl:url]; return [jsonParser objectWithString:jsonString error:NULL]; } - (NSDictionary *)downloadStats { id response = [self objectWithUrl:[NSURL URLWithString:@"http://www.example.com/JSON"]]; NSDictionary *feed = (NSDictionary *)response; return feed; [feed release]; } - (void)viewDidLoad { [super viewDidLoad]; [GlobalStatsScrollView setScrollEnabled:YES]; [GlobalStatsScrollView setContentSize:CGSizeMake(320, 360)]; } - (void)viewWillAppear:(BOOL)animated { NSLog(@"View appears"); // Download JSON Feed NSDictionary *feed = [self downloadStats]; totalproduced.text = [feed valueForKey:@"Produced"]; totalno.text = [feed valueForKey:@"Total"]; mostcommon.text = [feed valueForKey:@"Most Common"]; }

    Read the article

  • AS3 and cross-domain

    - by Davide Arcinotti
    I think i'm a little confused. I'm loading an swf, located at domainB.com/secondsubfolder, from an swf located at domainA.com/firstsubfolder. I always put the crossdomain.xml near the "loader" swf in domainA.com/firstsubfolder. It seems to not work, except if I put the crossdomain.xml in the root of the loaded content, domainB.com/crossdomain.xml. Did I always do it wrong, or is it because of some server setting? Using another domain for the loaded content, e.g. domainB_beta.com/secondsubfolder on another server just works as usual. Where do I have to look to change these settings? Does it depend on server settings, or am I doing something wrong? This is the loader actionscript code: import flash.display.Loader; import flash.net.URLRequest; import flash.system.Security; Security.allowDomain("domainB.com"); var context:LoaderContext = new LoaderContext(); context.securityDomain = SecurityDomain.currentDomain; var loaderMain:Loader = new Loader(); loaderMain.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); loaderMain.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler); loaderMain.load(new URLRequest('domainB/secondsubfolder/file.swf'),context); addChild(loaderMain); function errorHandler(event:ErrorEvent):void { trace("errorHandler says: " + event); }

    Read the article

  • Keyboard is not detecting as3

    - by Kaoru
    i got this problem, when i press 1 in keyboard, the function does not run, even i already declared it. How do i solve this? Here is the code: public function Character() { Constant.loaderMario.load(new URLRequest("mario.swf")); addEventListener(KeyboardEvent.KEY_DOWN, selectingPlayer); } private function selectingPlayer(event:KeyboardEvent):void { isoTextMario = new Word(); isoTextChocobo = new Word(); if (event.keyCode == Keyboard.NUMBER_1|| event.keyCode == 49) { Constant.marioSelected = true; if (Constant.marioSelected == true) { isoTextMario.marioCharacter(); addChild(isoTextMario); } } else if (event.keyCode == Keyboard.NUMBER_2 || event.keyCode == 50) { Constant.chocoboSelected = true; if (Constant.chocoboSelected == true) { isoTextChocobo.chocoboCharacter(); addChild(isoTextChocobo); } } }

    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

  • How to get adobe air air.navigateToURL(urlReq) to bring default bowser to focus

    - by Justin Vincent
    I'm working with adobe air and I have this code.. var urlReq = new air.URLRequest('http://google.com'); air.navigateToURL(urlReq); It's working correctly in that it is loading the page in the browser, but the issue is that adobe air is staying in the front and the browser is not being brought to the front... Perhaps it's because I'm working in runtime and not a complied app? (just off to try that now)

    Read the article

  • Why does Font.registerFont throw an error the second time a swf is loaded?

    - by Al Brown
    I've found an issue (in flash cs5) when using TLFTextfields and fonts shared at runtime, and I wondered if anyone has a solution. Here's the scenario. Fonts.swf: library for fonts (runtime shared DF4) Popup.swf: popup with a TLFTextfield (with text in it) using a font from Fonts.swf Main.swf : the main swf with a button that loads and unloads Popup.swf (using Loader or SafeLoader give the same results) Nice and simple, Run main.swf, click button and the popup appears with the text. Click the button again to remove the popup. All well and good now click the button again and I get the following error. ArgumentError: Error #1508: The value specified for argument font is invalid. at flash.text::Font$/registerFont() at Popup_fla::MainTimeline()[Popup_fla.MainTimeline::MainTimeline:12] I'm presuming it's happening because the font is already registered (checked when clicking before the load). Does anyone know how to get past this? If you are wondering here's my Main.as package { import fl.controls.Button; import flash.display.Loader; import flash.display.Sprite; import flash.events.Event; import flash.events.IOErrorEvent; import flash.events.MouseEvent; import flash.events.UncaughtErrorEvent; import flash.net.URLRequest; import flash.text.Font; public class Main extends Sprite { public var testPopupBtn:Button; protected var loader:Loader; public function Main() { trace("Main.Main()"); testPopupBtn.label = "open"; testPopupBtn.addEventListener(MouseEvent.CLICK, testClickHandler); } protected function testClickHandler(event:MouseEvent):void { trace("Main.testClickHandler(event)"); if(loader) { testPopupBtn.label = "open"; this.removeChild(loader); //loader.unloadAndStop(); loader = null; }else{ testPopupBtn.label = "close"; trace("Registered Fonts -->"); var fonts:Array = Font.enumerateFonts(false); for each (var font:Font in fonts) { trace("\t",font.fontName, font.fontStyle, font.fontType); } trace("<--"); loader = new Loader(); loader.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler); this.addChild(loader); try{ loader.load(new URLRequest("Popup.swf")); }catch(e:*){ trace(e); } } } private function uncaughtErrorHandler(event:UncaughtErrorEvent):void { trace("Main.uncaughtErrorHandler(event)", event); } } }

    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

  • I have problem loading all items from XML with for each

    - by vaha
    Hi all, I'm low level as3 programmer and I need help whit this code: I have gallery XML file: 1 0 Lokacije 1 1.jpg 2 2 Coaching 1 2.jpg 3 0 0 3.jpg And: var loader: URLLoader = new URLLoader(); loader.load(new URLRequest("gallery.xml"); var xml = new XML(evt.target.data); for each(var item in xml..item) { centralniText.htmlText = item.slika; } only shows last item from XML file: 3.jpg I want all. Please help.

    Read the article

  • Flex Air HTMLLoader blank pop up window when flash content is loaded

    - by user128938
    I have a flex Air program that loads external content with the HTMLLoader. Now for some reason whenever I load a page that has any flash content a blank system window pops up outside of my program. It's completely blank, all white with min, max and close buttons. If I close it any flash content I loaded stops working. For the life of my I can't figure out what's happening and there's no messages in the console and no title for the window. Does anyone have any ideas? I appreciate any help you can give. Here's the code I'm using: private var webPage:HTMLLoader; private function registerEvents():void { this.addEventListener(gameLoadEvent.GAME_LOAD, gameLoad); //webPage = new HTMLLoader(); } //function called back from Game Command to load correct game private function gameLoad(event:Event):void { var gameEvent:gameLoadEvent = event as gameLoadEvent; loadgame(gameEvent.url, gameEvent.variables); } private function loadgame(url:String, variableString:String):void { DesktopModelLocator.getInstance().scaleX = 1; DesktopModelLocator.getInstance().scaleY = 1; //var url:String = "http://pro-us.sbt-corp.com/aspx/member/LaunchGame.aspx"; var request:URLRequest = new URLRequest(url); //var variables:URLVariables = new URLVariables("gameNum=17&as=as1&t=demo&package=a&btnQuit=0"); if(variableString != null && variableString != ""){ var variables:URLVariables = new URLVariables(variableString); variables.exampleSessionId = new Date().getTime(); variables.exampleUserLabel = "guest"; request.data = variables; } webPage = HTMLLoader.createRootWindow(true, null, true, null); webPage.height = systemManager.stage.nativeWindow.height - 66; webPage.width = systemManager.stage.nativeWindow.width; webPage.load(request); webPage.navigateInSystemBrowser = false; flexBrowser.addChild(webPage); } ]]> </mx:Script> <mx:HTML id="flexBrowser" width="1366" height="658" backgroundAlpha="0.45" creationComplete="registerEvents();" x="0" y="0"> </mx:HTML>

    Read the article

  • Error #1009 Cannot access a property or method of a null object reference.

    - by user288920
    Hey everyone, I'm trying to import an external SWF with a scrollbar, calling out to an external .AS, into my main SWF. Someone told me, it's an issue that my scrollbar isn't instantiated yet, but stopped short of helping me how to fix the problem. Here's the error below: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Scrollbar/init() at Sample2_fla::MainTimeline/scInit() at flash.display::DisplayObjectContainer/addChild() at Sample2_fla::MainTimeline/frame1() On my main SWF, I was to click a button and load my external SWF. I want to then click another button in the external SWF and reveal my scrollbar (alpha=1;). The scrollbar is the issue. Here's my script: Sample1.swf (main) this.addEventListener(MouseEvent.CLICK, clickListener); var oldSection=null; function clickListener(evt:Event) { if (evt.target.name=="button_btn") { loadSection("Sample2.swf"); } } function loadSection(filePath:String) { var url:URLRequest=new URLRequest(filePath); var ldr:Loader = new Loader(); ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, sectionLoadedListener); ldr.load(url); } function sectionLoadedListener(evt:Event) { var section=evt.target.content; if (oldSection) { removeChild(oldSection); } oldSection=section; addChild(section); section.x=0; section.y=0; } Sample2.SWF (external): import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; scroll_mc.alpha=0; import Scrollbar; var sc:Scrollbar=new Scrollbar(scroll_mc.text,scroll_mc.maskmc,scroll_mc.scrollbar.ruler,scroll_mc.scrollbar.background,scroll_mc.area,true,6); sc.addEventListener(Event.ADDED, scInit); addChild(sc); function scInit(e:Event):void { sc.init(); } button2_btn.addEventListener(MouseEvent.CLICK, clickListener); function clickListener(evt:MouseEvent){ TweenMax.to(this.scroll_mc, 1,{alpha:1}); } I really appreciate your help. Cheers!

    Read the article

  • FLEX: how to correctly pass the link to a page ?

    - by Patrick
    hi, I'm using <mx:LinkButton click="navigateToURL(new URLRequest(event.currentTarget.label.toString()))" /> to open a browser window to display the website on the label of my LinkButton. However I cannot correctly pass the link.. you see the problem: file://localhost/..myapp/bin-debug/www.google.com thanks

    Read the article

  • FLEX: how can I cut the strings longer than N characters

    - by Patrick
    hi, what's the easiest way to cut string in Flex ? I mean, I have a sequence of urls, I want them at most 60 characters length. If they are longer they should be cut and "..." should be added at the end. <mx:LinkButton label="{bookmarksRepeater.currentItem.name}" click="navigateToURL(new URLRequest(event.currentTarget.label.toString()))" /> thanks

    Read the article

  • i can't get variable in function.

    - by kaym
    i can't read the variable in the function, i want to use it outside the function, here is my code. var contentLoader:URLLoader = new URLLoader(); contentLoader.load(new URLRequest("http://localhost/data.php")); function onComplete(event:Event):void { var txtu:String = event.target.data; } contentLoader.addEventListener(Event.COMPLETE, onComplete); trace(txtu); thanks.

    Read the article

  • How to set size (width,height) of externally loaded swf

    - by Raj
    Hi, I have loaded swf using following code, var loader:Loader = new Loader(); loader.load(new URLRequest("XYZ.swf")); addChild(loader); How do I control height and width of this loaded swf. I tried var mc = MovieClip(loader.loaderContentInfo.content); mc.width = 320; mc.height = 240; this gives null object error.

    Read the article

  • Help with converting an XML into a 2D level (Actionscript 3.0)

    - by inzombiak
    I'm making a little platformer and wanted to use Ogmo to create my level. I've gotten everything to work except the level that my code generates is not the same as what I see in Ogmo. I've checked the array and it fits with the level in Ogmo, but when I loop through it with my code I get the wrong thing. I've included my code for creating the level as well as an image of what I get and what I'm supposed to get. EDIT: I tried to add it, but I couldn't get it to display properly Also, if any of you know of better level editors please let me know. xmlLoader.addEventListener(Event.COMPLETE, LoadXML); xmlLoader.load(new URLRequest("Level1.oel")); function LoadXML(e:Event):void { levelXML = new XML(e.target.data); xmlFilter = levelXML.* for each (var levelTest:XML in levelXML.*) { crack = levelTest; } levelArray = crack.split(''); trace(levelArray); count = 0; for(i = 0; i <= 23; i++) { for(j = 0; j <= 35; j++) { if(levelArray[i*36+j] == 1) { block = new Platform; s.addChild(block); block.x = j*20; block.y = i*20; count++; trace(i); trace(block.x); trace(j); trace(block.y); } } } trace(count);

    Read the article

  • Google Maps Polygon - Not creating independent

    - by ferronrsmith
    I am basically populating a map with polygons, I am using the flex sdk. The problem I am having is that each time it adds a parish it keep adding to the previous polygons and treating it as one. HELP!! <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <maps:Map xmlns:maps="com.google.maps.*" id="map" mapevent_mapready="onMapReady(event)" width="100%" height="100%" key="ABQIAAAAGe0Fqwt-nY7G2oB81ZIicRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxRcFmaI_t1gtsS5UN6mWQkH9kIw6Q"/> <mx:Script> <![CDATA[ import com.google.maps.Color; import com.google.maps.LatLng; import com.google.maps.Map; import com.google.maps.MapEvent; import com.google.maps.MapType; import com.google.maps.controls.ZoomControl; import com.google.maps.overlays.Polygon; import com.google.maps.overlays.PolygonOptions; import com.google.maps.styles.FillStyle; import com.google.maps.styles.StrokeStyle; import mx.controls.Alert; import mx.utils.ColorUtil; import mx.utils.object_proxy; private var polys:Array = new Array(); private var labels:Array = new Array(); // private var pts:Array = new Array(); // private var poly:Polygon; // private var map:Map; private function onMapReady(event:Event):void { map.setCenter(new LatLng(18.070146,-77.225647), 9, MapType.NORMAL_MAP_TYPE); map.addControl(new ZoomControl()); map.enableScrollWheelZoom(); map.enableContinuousZoom(); getXml(); } public function getXml():void { var xmlString:URLRequest = new URLRequest("parish.xml"); var xmlLoader:URLLoader = new URLLoader(xmlString); xmlLoader.addEventListener("complete", readXml); } private function readXml(event:Event):void { var markersXML:XML = new XML(event.target.data); var markers:XMLList = markersXML..parish; //var markersCount:int = markers.length(); var i:Number; var t:Number; for(i=0; i < markers.length(); i++) { var marker:XML = markers[i]; var name:String = marker.@name; var colour:String = marker.@colour; // Alert.show(""); var the_p:XMLList = markers..point; var pts:Array = []; for(t=0; t < the_p.length(); t++) { var theparish:XML = the_p[t]; pts[t] = new LatLng(theparish.@lat,theparish.@lng); // Alert.show("working" + theparish.@lat); // var pts.push(new LatLng(theparish.@lat,theparish.@lng)); } var poly:Polygon = new Polygon(pts, new PolygonOptions({ strokyStyle: new StrokeStyle({ color: colour, thickness: 1, alpha: 0.2}), fillStyle: new FillStyle({ color: colour, alpha: 0.2}) })); //polys.push(poly); //labels.push(name); Alert.show("this"); pts = [] map.addOverlay(poly); } } /* public function createMarker(latlng:LatLng, name:String, address:String, type:String): Marker { var marker:Marker = new Marker(latlng, new MarkerOptions({icon: new customIcons[type], iconOffset: new Point(-16, -32)})); var html:String = "<b>" + name + "</b> <br/>" + address; marker.addEventListener(MapMouseEvent.CLICK, function(e:MapMouseEvent):void { marker.openInfoWindow(new InfoWindowOptions({contentHTML:html})); }); return marker; } */ ]]> </mx:Script> </mx:Application>

    Read the article

  • How to catch a HTTP 404 in Flash

    - by Quandary
    When I execute the (2nd) below code with a wrong url (number '1' added at the URL end), I get the below error. How can I catch this error, in case the url is wrong, so that I can give out an error message to the user ? Error opening URL 'http://localhost/myapp/cgi-bin/savePlanScale.ashx1?NoCache%5FRaumplaner=F7CF6A1E%2D7700%2D8E33%2D4B18%2D004114DEB39F&ScaleString=5%2E3&ModifyFile=data%2Fdata%5Fzimmere03e1e83%2D94aa%2D488b%2D9323%2Dd4c2e8195571%2Exml' httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=404] status: 404 Error: Error #2101: Der an URLVariables.decode() übergebene String muss ein URL-kodierter Abfrage-String mit Name/Wert-Paaren sein. at Error$/throwError() at flash.net::URLVariables/decode() at flash.net::URLVariables() at flash.net::URLLoader/onComplete() public static function NotifyASPXofNewScale(nScale:Number) { var strURL:String ="http://localhost/myapp/cgi-bin/savePlanScale.ashx1" // CAUTION: when called from website, RELATIVE url... var scriptRequest:URLRequest = new URLRequest(strURL); var scriptLoader:URLLoader = new URLLoader(); // loader.dataFormat = URLLoaderDataFormat.TEXT; // default, returns as string scriptLoader.dataFormat = URLLoaderDataFormat.VARIABLES; // returns URL variables // loader.dataFormat = URLLoaderDataFormat.BINARY; // to load in images, xml files, and swf instead of the normal methods var scriptVars:URLVariables = new URLVariables(); scriptLoader.addEventListener(Event.COMPLETE, onLoadSuccessful); scriptLoader.addEventListener(IOErrorEvent.IO_ERROR, onLoadError); scriptLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler); scriptLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError); scriptVars.NoCache_Raumplaner = cGUID.create(); scriptVars.ScaleString = nScale; scriptVars.ModifyFile = "data/data_zimmere03e1e83-94aa-488b-9323-d4c2e8195571.xml"; scriptRequest.method = URLRequestMethod.GET; scriptRequest.data = scriptVars; scriptLoader.load(scriptRequest); function httpStatusHandler(event:HTTPStatusEvent):void { trace("httpStatusHandler: " + event); trace("status: " + event.status); } function onLoadSuccessful(evt:Event):void { trace("cSaveData.NotifyASPXofNewScale.onLoadSuccessful"); trace("Response: " + evt.target.data); ExternalInterface.call("alert", "Die neue Skalierung wurde erfolgreich gespeichert."); //getURL("javascript:alert(\""+"Die neue Skalierung wurde erfolgreich gespeichert.\\nALLE Instanzen des Browsers schliessen und neu starten, damit die Änderung in Kraft tritt."+"\");"); if (evt.target.data.responseStatus == "YOUR FAULT") { trace("Error: Flash transmitted an illegal scale value."); ExternalInterface.call("alert", "Fehler: Flash konnte die neue Skalierung nicht abspeichern."); } if (evt.target.data.responseStatus == "EXCEPTION") { trace("Exception in ASP.NET: " + evt.target.data.strError); ExternalInterface.call("alert", "Exception in ASP.NET: " + evt.target.data.strError); } } function onLoadError(evt:IOErrorEvent):void { trace("cSaveData.NotifyASPXofNewScale.onLoadError"); trace("Error: ASPX or Transmission error. ASPX responseStatus: " + evt); ExternalInterface.call("alert", "ASPX - oder Übertragungsfehler.\\nASPX responseStatus: " + evt); //getURL("javascript:alert(\"" + "ASPX - oder Übertragungsfehler.\\nASPX responseStatus: " + receiveVars.responseStatus + "\");"); } function onSecurityError(evt:SecurityErrorEvent):void { trace("cSaveData.NotifyASPXofNewScale.onSecurityError"); trace("Security error: " + evt); ExternalInterface.call("alert", "Sicherheitsfehler. Beschreibung: " + evt); } }

    Read the article

  • Actionscript multiple file upload, with parameter passing is not working

    - by Metropolis
    Hey everyone, First off, I am very bad at flash/actionscript, it is not my main programming language. I have created my own file upload flash app that has been working great for me up until this point. It uses PHP to upload the files and sends back a status message which gets displayed in a status box to the user. Now I have run into a situation where I need the HTML to pass a parameter to the Actionscript, and then to the PHP file using POST. I have tried to set this up just like adobe has it on http://livedocs.adobe.com/flex/3/html/help.html?content=17_Networking_and_communications_7.html without success. Here is my Actionscript code import fl.controls.TextArea; //Set filters var imageTypes:FileFilter = new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png"); var textTypes:FileFilter = new FileFilter("Documents (*.txt, *.rtf, *.pdf, *.doc)", "*.txt; *.rtf; *.pdf; *.doc"); var allTypes:Array = new Array(textTypes, imageTypes); var fileRefList:FileReferenceList = new FileReferenceList(); //Add event listeners for its various fileRefList functions below upload_buttn.addEventListener(MouseEvent.CLICK, browseBox); fileRefList.addEventListener(Event.SELECT, selectHandler); function browseBox(event:MouseEvent):void { fileRefList.browse(allTypes); } function selectHandler(event:Event):void { var phpRequest:URLRequest = new URLRequest("ajax/upload.ajax.php"); var flashVars:URLVariables = objectToURLVariables(this.root.loaderInfo); phpRequest.method = URLRequestMethod.POST; phpRequest.data = flashVars; var file:FileReference; var files:FileReferenceList = FileReferenceList(event.target); var selectedFileArray:Array = files.fileList; var listener:Object = new Object(); for (var i:uint = 0; i < selectedFileArray.length; i++) { file = FileReference(selectedFileArray[i]); try { file.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, phpResponse); file.upload(phpRequest); } catch (error:Error) { status_txt.text = file.name + " Was not uploaded correctly (" + error.message + ")"; } } } function phpResponse(event:DataEvent):void { var file:FileReference = FileReference(event.target); status_txt.htmlText += event.data; } function objectToURLVariables(parameters:Object):URLVariables { var paramsToSend:URLVariables = new URLVariables(); for(var i:String in parameters) { if(i!=null) { if(parameters[i] is Array) paramsToSend[i] = parameters[i]; else paramsToSend[i] = parameters[i].toString(); } } return paramsToSend; } The flashVars variable is the one that should contain the values from the HTML file. But whenever I run the program and output the variables in the PHP file I receive the following. //Using this command on the PHP page print_r($_POST); //I get this for output Array ( [Filename] => testfile.txt [Upload] => Submit Query ) Its almost like the parameters are getting over written or are just not working at all. Thanks for any help, Metropolis

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >