A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Img Downloads & Save .... different behaviur in module Application ....

  1. #1
    Senior Member
    Join Date
    Apr 2008
    Location
    Rotorua / New Zealand
    Posts
    117

    Img Downloads & Save .... different behaviur in module Application ....

    Hi there,

    I developed awhile ago an App. for downloading Images onto the AIR desktop which works perfectly fine! yet when I wanted to use it within one of my many modules in a large AIR Application I got over & over that the FileStream(s) were not open to SAVE.

    So I build another App. with one of my saved DB codes (as below) which has NO error msg with a FileStream problem once included into the App. with the modules yet the error which comes up this time is (Error #2044; Unhandled IOErrorEvent: text=Error #2035: URL Not Found).

    I can't think of anything why this should not work or better why the FileStrems are not opening or why as in this case the URL is not found??? as both work OK in its own Applications.

    Any help would be appreciated! regards aktell

    Code:
    .......................................................................................
    	creationComplete="loadRemoteImage(textInputOne.text)">
    	
    	<mx:Script>
    		<![CDATA[
    			
    			import mx.graphics.codec.JPEGEncoder;
    			
    			private var _bitmapDataOne:BitmapData;
    			
    			private function loadRemoteImage(url:String):void {
    				
    				var loaderOne:Loader = new Loader();
    				
    				loaderOne.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
    				loaderOne.load(new URLRequest(url));
    			}
    			
    			private function completeHandler(event:Event):void {
    				
    				var loaderInfoOne:LoaderInfo = event.target as LoaderInfo;
    				imgOne.source = loaderInfoOne.content;
    				
    				var bitmapOne:Bitmap = loaderInfoOne.content as Bitmap;
    				_bitmapDataOne = bitmapOne.bitmapData;
    				
    
    				saveImage();
    			}
    			
    			private function saveImage():void {
    				
    				var extensionOne:String;
    				var imgByteArrayOne:ByteArray;
    				
    				if(textInputOne.text.indexOf('.jpg') != -1) {
    					
    					var jpegEncoderOne:JPEGEncoder = new JPEGEncoder(100);
    					imgByteArrayOne = jpegEncoderOne.encode(_bitmapDataOne);
    					extensionOne = '.jpg';
    				}
    				else
    					return;
    				
    				var fileOne:File = File.desktopDirectory.resolvePath('Files/test'+ extensionOne);
    				var fileStreamOne:FileStream = new FileStream();
    				
    				fileStreamOne.open(fileOne, FileMode.WRITE);
    				fileStreamOne.writeBytes(imgByteArrayOne);
    				
    				fileStreamOne.close();
    			}
    		]]>
    	</mx:Script>
    
    	<mx:TextInput 
    		id="textInputOne"
    		text="com/waterfront.jpg"
    		visible="false"/>
    	
    	<mx:SWFLoader 
    		id="imgOne"/>

  2. #2
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    If it's the same script, and you think everything should be OK, and it isn't , maybe the images URL changed, or the images doesn't exist anymore, or the server in which the images lived is down... good luck
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

  3. #3
    Senior Member
    Join Date
    Apr 2008
    Location
    Rotorua / New Zealand
    Posts
    117
    Do you just send meaningless answers to every thread on here! just to get your own reply count up or do you actually read any text somebody writes???
    What this has all to do with my question:
    '... maybe the images URL changed, or the images doesn't exist anymore, or the server in which the images lived is down ...' do you believe that people are as dumb as you like to make out answering stupidly is simple pathetic! regards aktell

  4. #4
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    I'm just trying to help, you freaking arrogant. People like you don't deserve anything
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

  5. #5
    Senior Member
    Join Date
    Apr 2008
    Location
    Rotorua / New Zealand
    Posts
    117
    How can you claim that you want to help when you do not even read the text? do you think suggestions like your Baby Ideas '... maybe the images URL changed, or the images doesn't exist anymore, or the server in which the images lived is down ...' are for developers with two cents of brain between their ears in any way helpful! well, of course not as it seems it comes from somebody without any of it!
    You are just cloeless mate!

  6. #6
    Senior Member
    Join Date
    Apr 2008
    Location
    Rotorua / New Zealand
    Posts
    117
    Hi there,
    Found after been all day yesterday on this as well as today this thread which seem to highlight problems I'm experienced! I think that the problems are occurring in the change over been developed in MX 4.0 SDK yet used in the 4.6 SDK with MX & FX pointing towards the URLLoader!
    I have tried about seven different full codes examples by now with all the same outcome 'NO Stream or NO URL Found' so I mite try all of this again with Xml and see if that will fix this hick up!

    http://forums.adobe.com/message/4843188

    http://www.onegiantmedia.com/common-...-external-urls

    http://www.pavlasek.sk/devel/?p=10
    Last edited by aktell; 02-21-2014 at 04:50 PM.

  7. #7
    Senior Member
    Join Date
    Apr 2008
    Location
    Rotorua / New Zealand
    Posts
    117
    Well, finally got somewhere to make this all work! as after reading a few items I found and got this of http://www.pavlasek.sk/devel/?p=10 and which gave me the idea to try it in two(2) stage step way (Flash Player 10 onwards) which I also read somewhere else so that worked perfectly well!!!

    What a shame the self proclaimed forum Guru was slidely out with his '... maybe the images URL changed, or the images doesn't exist anymore, or the server in which the images lived is down ...' ..... Pathetic!

    regards aktell


    **** Flex 10 – upload files using URLRequest

    In Flash player it was possible until version 10 to upload files only by FileReference.upload method (there were some ugly hacks – such as uploading in external iframe).

    Uploading files using directly FileReference.upload has some serious problems problems. Especially on Firefox, Flash player plugin creates it’s own request (different UserAgent, session and so) so on server it is handled in different session. All the parameters has to be sent, or some hacks has to be done (I manually set the jsessionid to each request). ****
    Last edited by aktell; 02-21-2014 at 06:42 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center