downloading image in as3 from client url - actionscript-3

here is the link of my Flash application
http://www.asa.com.pk/
hit the above URL and click on the PostCard section shown.. This will show you image and button to download that image. Application works fine at above URL and it downloads the file too but when any user hits the alternate url , the file is not downloaded..
http//asa.com.pk/

My debugger shows:
Error #2044: SecurityErrorEvent no controlado: text=Error #2048: Violación de la seguridad Sandbox: http://asa.com.pk/main.swf no puede cargar datos desde http://www.asa.com.pk/downloads/largeimage/mcb.gif.
at main_fla::MainTimeline/Download_Started()
Quick Google Search ended on:
Actionscript Error #2044: Unhandled SecurityErrorEvent:. text=Error #2047: Security sandbox violation: LocalConnection.send: 127.0.0.1 cannot access
http://www.actionscript.org/forums/showthread.php3?t=148714
I think you will get it after this, basically it's a crossdomain.xml thing.
I have tested your app, and the error it's exactly because of the flash player 10 sandbox feature, you need to use a crossdomain.xml file where you allow both domains to be cross-accessed.

There are a number of things you can do to fix security errors like this.
Create a valid crossdomain.xml file under both http://domain.com & http://www.domain.com
Set the DNS to forward http://domain.com to http://www.domain.com permanently
In your AS code add Secuirty.allowdomain( "*" );
Hope this helps.

Related

Web page launch error

How to go about this error "Launch terminated : ERROR: Course launch was canceled because the HACP getParam failed to find the user information". cannot open the web page beacause of this.
The reason for this is that you might have left the browser idle for a long time and the session got logged out.
Solution: Login to the Skillport or other Portal which is linked to the Skillport, and everything should be all set.
Please be more specific. Which website? Which browser?
Googling the error (which you should have done first) yields this result:
I get the Skillsoft error: “Launch terminated: ERROR: Course launch was cancelled because the HACP getParam failed to find the user information”:
Per our Required Browser Settings document, please ensure that *.skillport.com is added to your Trusted Sites zone in Internet Explorer.
If you're not on "skillport.com", whatever it is, you'll probably want to add the domain you're on to the Trusted Sites instead.

Android Instant apps play video fail, show "Can't play this video."

(Instant apps can play video normally use webview, but videoview fail.
Use Android Videoview play video, The APK can play normally, but the Instant apps can not play. show error: Can't play this video.
java code:
Uri uri = Uri.parse("https://v1-tt.ixigua.com/40f0bfa756a159d27864bb70aeabdb8b/59f457f6/video/m/22033a84279cb1145a8bafee6279724505b1151dcf0000063157252c98c/");
VideoView videoView = (VideoView) findViewById(R.id.videoView);
videoView.setVideoURI(uri);
videoView.start();
logcat show:
10-28 06:31:01.952 21522-21522/? W/MediaPlayer: Couldn't open
https://v1-tt.ixigua.com/40f0bfa756a159d27864bb70aeabdb8b/59f457f6/video/m/22033a84279cb1145a8bafee6279724505b1151dcf0000063157252c98c/:
java.io.FileNotFoundException: No content provider:
https://v1-tt.ixigua.com/40f0bfa756a159d27864bb70aeabdb8b/59f457f6/video/m/22033a84279cb1145a8bafee6279724505b1151dcf0000063157252c98c/
10-28 06:31:01.953 21522-21522/? V/MediaHTTPService:
MediaHTTPService(android.media.MediaHTTPService#79aba57): Cookies:
null 10-28 06:31:01.954 21522-21522/? E/MediaPlayerNative: Unable to
create media player 10-28 06:31:01.958 21522-21522/? W/VideoView:
Unable to open content:
https://v1-tt.ixigua.com/40f0bfa756a159d27864bb70aeabdb8b/59f457f6/video/m/22033a84279cb1145a8bafee6279724505b1151dcf0000063157252c98c/
java.io.IOException: setDataSource failed.: status=0x80000000
at android.media.MediaPlayer.nativeSetDataSource(Native Method)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1153)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1141)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1059)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1080)
at android.widget.VideoView.openVideo(VideoView.java:399)
at android.widget.VideoView.-wrap0(Unknown Source:0)
at android.widget.VideoView$7.surfaceCreated(VideoView.java:678)
at android.view.SurfaceView.updateSurface(SurfaceView.java:664)
at android.view.SurfaceView$2.onPreDraw(SurfaceView.java:143)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:977)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2337)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1386)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6733)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 10-28
06:31:01.958 21522-21522/? D/VideoView: Error: 1,0
The error does not seem to be related to Android Instant Apps, since playing a video in this manner works.
I'm getting a 403 error when trying to access the video you provided.
Make sure that accessing the video's file access is correct for the app's user.

Specific Youtube Video Gives Error when play in desktop application

Description:
I have a youtube player in My Desktop Application. I implement it by using SWFLoader and using this url http://www.youtube.com/v/yd71LWhCO4s?version=3&autoplay=0&autohide=0&fs=1&showinfo=0 it works. 'yd71LWhCO4s' is a Video id, if I change it to FqJdzYY_Fas then it gives me an error.
`Error #2044: Unhandled adError:. text=Failed to load resource: Error
Load Never Completed. URL:
http://pagead2.googlesyndication.com/pagead/gadgets/overlay/OverlayTemplate.swf.
I get the url from the error message and i am interested to know about the swf at this URL. So i use this url directly in my browser, and my firewall blocked it due to advertising of Google. If I click on 'dismiss all' then the video playes.
I want to remove this error, how can I do that?

Flex URLStream Security sandbox violation

I want to get URLStream from MJPG, but I have received Error #2048: Security sandbox violation error in release version.
What I'm trying to do:
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var stream:URLStream = new URLStream();
//receiving this error event in onStreamSecurityError handler:
//Error #2048: Security sandbox violation: {swf} cannot load data from {url}
stream.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onStreamSecurityError);
//load method have no loader context option
stream.load(new URLRequest("http://anydomain.com/mjpg/video.mjpg"));
Setting up crossdomain.xml is not the solution cause the application should able to load a stream from any remote server.
As I remember with flash.display.Loader class I set up LoaderContext and application domain. After that flex app can load resources from any domain. But I don't know what to do with URLStream.
Do you have any solution or a workaround of the Error #2048 ?
It's not possible. You can't remotely grant access to another domain, because it's not yours to grant. The allowDomain() function doesn't do that, it does it the other way around:
Lets SWF files in the identified domains access objects and variables in the SWF file that contains the allowDomain() call.
If your SWF is on domain a.com, and you're adding the line Security.allowDomain("b.com") in it, than grants access to a SWF on domain b.com to your SWF. It does not grant you access to domain b.com.
You can find more detailed info on this in the documentation of allowDomain()
AJAX won't let you do that either, or better put, the browser's won't let you. They're all playing by the same rules.
In order to overcome this, you must proxy the request through a server side script sitting on the same domain as your SWF. It can be in PHP with curl, or whatever you find easier. This video explains how and why.

AIR app: navigateToURL throws a SecurityError #2193

I'm trying to port an existing web app (ActionScript 3 only project) to AIR, to run as a standalone application. One of its features is opening urls in a browser window. But calling navigateToURL(new URLRequest(url)) throws this SecurityError:
SecurityError: Error #2193: Security
sandbox violation: navigateToURL:
app:/AIRDigE.swf cannot access
http://www.youtube.com/watch?v=xCPwAr0xnGE.
at global/flash.net::navigateToURL()
when run from Flash Builder 4.
Googling doesn't really help me with this specific error number.
Adobe's reference on Security Sandboxes states that any AIR application running with Security.sandboxType==Security.APPLICATION (which my application uses) should be able to connect to any domain, but apparently that doesn't count for me.
Any ideas?
Thanks, Frank
Sorry folks, this morning I found the answer myself: the url that I passed into the URLRequest had a space in front of it (it was loaded from an xml feed that is evidently producing faulty urls).
So it seems that a url with an invalid protocol causes that error, and putting a trim() around the url fixed it.
I was getting this error because of using double backward slashes in the web link like "http:\\www.youtube.com"
Where as I supposed to use "http:*//*www.youtube.com"
try using URLRequest with navigateToURL
navigateToURL(new URLRequest("http://www.youtube.com"));
UPDATED:
navigateToURL(new URLRequest("http://www.youtube.com"),"blank");