Flex - Error #2015: Invalid BitmapData - apache-flex

I really need some help on this, as I have no idea how to fix it! :/
Got a problem here.
My application is working fine on my computer, both offline and online (flash uploaded to our webservers). It works fine in both IE and Firefox.
However, some user do have problem running it in IE, while Firefox is still ok..
The app itself works, the error comes when trying to buffer some frames to a BitmapData.
So, in Firefox, it works great.
In IE (on my computer) it works great.
In IE (on other computers) it does not work, and this error is cast. It happens right at the end, which means it all works fine until the last time the function is run. (it's run like this to allow updating the progressbar. If I set the for loop to 180 then it all freezes untill completed. Thats why I do 10 and 10.)
Any help regarding this would be great, as I'm completely stuck here...
I've traced the size of the bitmapdata, and at the time of the error it's 1920x1080, which is what it's supposed to be.
This is the code where it fails:
fpsoSWFBuffer = new BitmapData(fpsoMC.width, fpsoMC.height, false, 0x00ff0000);
And this is the whole function where the code is located:
public function bufferFpsoImages(evt:TimerEvent):void{
for (var i:int = 0; i<10; i++){
fpsoMC.gotoAndStop(currentFpsoFrame);
fpsoSWFBuffer = new BitmapData(fpsoMC.width, fpsoMC.height, false, 0x00ff0000);
fpsoSWFBuffer.draw(fpsoMC);
fpsoImgArray[currentFpsoFrame] = fpsoSWFBuffer;
currentFpsoFrame++;
}
if (currentFpsoFrame <= (totImg360-10)){
// Still buffering frames //
myLoadingPanel.setBufferProg(currentFpsoFrame);
var fpsoTimer:Timer = new Timer(1,1);
fpsoTimer.addEventListener(TimerEvent.TIMER_COMPLETE, bufferFpsoImages);
fpsoTimer.start();
}else{
// All frames buffered //
currentFpsoFrame = 0;
fpsoLoaded = true;
fpsoLoading = false;
ncFPSO.removeElement(myLoadingPanel);
myLoadingPanel = null;
var fpsoBitmap:Bitmap = new Bitmap(fpsoImgArray[0]);
fpsoBitmap.smoothing = true;
fpsoImage.source = fpsoBitmap;
}
}
EDIT:
I've added some debugging functions to it now, to be able to know where it fails. (as it works during debugging, I need to debug the realtime version online).
This is what I get:
ErrorID=2015
ErrorMessage=Error #2015
ErrorPos=fpsoSWFBuffer = new BitmapData(1920, 1080, false, 0x00ff0000);
CurrentFpsoFrame=168
Position in For Loop=8
EDIT2: And here is the error message I finally got inside of Flash Builder. So now it's crashing here too.. =/
ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData/ctor()
at flash.display::BitmapData()
at Main/bufferTemplateImages()[E:\Workspace - Flash Builder\vCog Workspace\vCog Communicator 3.0\src\Main.mxml:461]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.utils::Timer/tick()

Your buffering 1.5gb of memory? Flash keeps requesting memory from the OS until the OS can't give anymore. If it works on your computer, but not others, maybe their computers are running a lot of other program requesting memory and can't supply enough memory to your project. The other thing I would check is, what version of the OS they are using 32bit windows only can see a max of 2Gb of memory. Although This is simply a theory. Maybe try and compress the images first to limit memory usage.

It seems like IE have some sort of max memory useage restriction with flash, and Firefox does not.
I might be wrong, but I fixed it by rewriting my code to handle smaller files (less memory useage) and loading in a high-res image after the user have rotated the view.
I used to buffer 1,5GB meory, now I buffer about 750MB and it works.
Still strange that IE has limitations, and Firefox and Chrome does not...
Oh well.. =/

Related

ShellExecute fails for local html or file URLs

Our company is migrating our help systems over to HTML5 format under Flare. We've also added Topic based access to the help systems using Flare CSHID's on the URI command line for accessing the topic directly, such as index.html#CSHID=GettingStarted to launch the GettingStarted.html help page.
Our apps are written in C++ and leverage the Win32 ShellExecute() function to spawn the default application associated with HTTP to display the help system. We've noticed that ShellExecute() works fine when no hashtag is specified, such as
ShellExecute(NULL, _T("open"), _T("c:\\Help\\index.html"), NULL, NULL, SW_SHOWNORMAL);
This function will launch the default browser associated with viewing HTML pages and in this case, the File:/// protocol handler will kick in, the browser will launch and you will see file:///c:/Help/index.html in the address bar.
However, once you add the # information for the topic, ShellExecute() fails to open the page
ShellExecute(NULL,_T("open"),_T("c:\\Help\\index.html#cshid=GettingStarted"),NULL,NULL,SW_SHOWNORMAL);
If the browser opens at all, you'll be directed to file:///c:/Help/index.html without the #cshid=GettingStarted topic identification.
Note that this is only a problem if the File protocol handler is engaged through ShellExecute(), if the help system lives out on the web, and the Http or Https protocol handler is engaged, everything works great.
For our customers, some of whom are on a private LAN, we cannot always rely on Internet access, so our help systems must ship with the application.
After some back-and-forth with Microsoft's MSDN team, they reviewed the source code to the ShellExecute() call and it was determined that yes, when processing File:/// based URLs in ShellExecute(), the ShellExecute() call will strip off the # and any data it finds after the # before launching the default browser and sending in the HTML page to open. MS's stance is that they do this deliberately to prevent injections into the function.
The solution was to beef up the ShellExecute() call by searching the URL for a # and if one was found, then we would manually launch the default browser with the URL. Here's the pseudocode
void WebDrive_ShellExecute(LPCTSTR szURL)
{
if ( _tcschr(szURL,_T('#')) )
{
//
//Get Default Browser from Registry, then launch it.
//
::RegGetStr(HKCR,_T("HTTP\\Shell\\Open\\Command"),szBrowser);
::CreateProcess ( NULL, szBrowser + _T(" ") + szURL, NULL, NULL, FALSE, 0, NULL, NULL, &sui, &pi);
}
else
ShellExecute(NULL,_T("open"),szURL,NULL,NULL,SW_SHOWNORMAL);
}
Granted there's a bit more to the c++ code, but this general design worked for us.
I tried WebDrive's solution and it didn't really work on Windows 10.
"HTTP\Shell\Open\Command" default value is set to Internet Explorer path, regardless of what my default browser setting. However, for Internet Explorer that solution DOES work.
Process to fetch default browser path on Windows 10 is a bit different (How to determine the Windows default browser (at the top of the start menu)) but even then the solution is not guaranteed to work, depending on the browser. E.g. for me it didn't work with Edge.
To get it to work with Edge I had to add "file:///" to the URL -- but that also makes the URL work with ShellExecute(). So, at least on Windows 10, all I needed to do was this:
ShellExecute(NULL,_T("open"),_T("file:///c:/Help/Default.html#cshid=1648"),NULL,NULL,NULL);
UPDATE:
The above stopped working months ago. What I eventually did was go through temporary file, as described here: https://forums.madcapsoftware.com/viewtopic.php?f=9&t=28376#p130613
Use FindExecutable() to get the default browser and pass the full help file path with its queries (?) and fragments (#) as the lpParameters parameter to ShellExecute(). They won't get stripped off there.
Then handle the case if it is a Store App (most likely Microsoft Edge).
Pseudo C code:
if (FindExecutable(_T("c:\Help\index.html"), NULL, szBrowser)
{
if (szBrowser == _T("C:\WINDOWS\system32\LaunchWinApp.exe"))
{
// default browser is a Windows Store App
szBrowser = _T("shell:AppsFolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge");
}
}
else
{
szBrowser = szURL;
szURL = NULL;
}
ShellExecute(NULL, NULL, szBrowser, szURL, NULL, SW_SHOWNORMAL);
I solved the problem without using any method other than ShellExecute in a Qt Application
QString currentpath = QDir::currentPath();
QString url = "/help//html/index.html#current";
QString full_url = "file:///" + currentpath + url;
QByteArray full_url_arr= full_url.toLocal8Bit();
LPCSTR lp = LPCSTR(full_url_arr.constData());
ShellExecute(NULL, "open", lp, NULL, NULL, SW_SHOWNORMAL);

Loading Song from file with Uri - XNA 4.0

I am attempting to load a song from Uri for use in my game. Code as below:
Uri uriStreaming = new Uri("file://E:/MySong.mp3");
Song song = Song.FromUri("Song Name", uriStreaming);
MediaPlayer.IsMuted = false;
MediaPlayer.Volume = 0.5f;
MediaPlayer.Play(song);
When I get in game no audio is playing at all, though I have no errors at all. I've also tried it with a http:/ link for an mp3 and it works fine, so I'm not quite sure of the issue.
Any ideas for a fix?
Edit: After further investigation of this problem, I've found out that it's the ID3 tags causing the issue, specifically if it is ID3v2.4 and if I use a tool to remove them, it plays fine. However, I can't expect my user to do this with all of their audio, so is there a workaround for this?

VLC-Player in adobe Air App does not stop/quit

Well i have an adobe air , downloaded from below link.. it is wonderful app..
http://www.adobe.com/devnet/air/flex/articles/air_screenrecording.html
and this works fine. It captures my screen , record audio but it just does not stop or quit as vlc-player.exe continues to run in the task manager.
i tried lots of vlc- commands but it just does not stop once it starts capturing screen video.
I need help on it..
I know this is a old thread, but just in case someone wants to know...
You can't use rc-fake-tty because Windows doesn't support terminal. For Windows, tell VLC to run with only one instance, then send it the quit command as a separate NativeProcess call.
So, in the linked article, change the stopRecording() method to this:
public function stopRecording():void{
var startupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
startupInfo.executable = vlcFile;
var processArgs:Vector.<String> = new Vector.<String>();
processArgs.push("-I");
processArgs.push("rc"); //Remote control
processArgs.push("--one-instance");
processArgs.push("vlc://quit");
startupInfo.arguments = processArgs;
var killSwitch:NativeProcess = new NativeProcess();
killSwitch.start(startupInfo);
}
And make sure to add this:
processArgs.push("--one-instance");
To your initial screen record startupInfo in startRecording() method.
I quit using vlc for the same reason and started to write my recording application using .Net 4, but i am having less performance using c# now.
Edit:
VLC for windows does not support fake rc control so setting rc-fake-tty is useless. As the very last try, i wanna control is via socket. If you got it working this way, please make me informed.

Wowza + Flex not reproducing whole audio

I'm writing a flex app, which must record an audio and then playback. It records just fine, I can hear the flv on the server, but when it comes to the playback it cuts the end a little bit, and each time I ask to reproduce again it cuts a little bit more. What can it be? I guess it's something related to buffer management, but I don't know exactly. Any thoughts?
EDIT: Here's the code I'm using to playback. It is called from a mediator:
var streamPlayClient:Object = new Object();
this.stream.client = streamPlayClient;
streamPlayClient.onPlayStatus = function(infoObject:Object):void {
if (infoObject.code == "NetStream.Buffer.Flush") {
stopPlayback();
}
}
this.stream.play("flv:" + this.streamName);
As it turns out, I have to handle the NetStream.Buffer.Empty event, instead of the NetStream.Play.Complete or the NetStream.Buffer.Flush.

uploading a file on mac os x using adobe flex 3

I've created a fileUpload.mxml component in flex 3 which basically uploads m4a's to a designated server. The general code is below:
private var uploadURL:URLRequest;
private var file:FileReference;
file=new FileReference();
file.browse(getTypes());
var params:URLVariables = new URLVariables();
params.fileID = model.selectedFileUpload.fileUploadId.toString();
uploadURL.data = params;
uploadURL.url= model.mainDir + "/php/upload.php";
file.upload(uploadURL);
Everything works fine on a windows pc, but not on a mac pc. It stops at file.upload(uploadURL) (and thus doesn't trigger Event.COMPLETE).
Has anyone experienced this problem on the mac os x? And if so, how did you overcome it?
Any advice would be appreciate.
Regards,
Angus
The COMPLETE event is not triggered in Mac due to a bug UNLESS the server send ANY output back to the server.
A simple echo of any string would do.
this issue is detailed in the SWFUpload boards along this very solution (there may be other causes, also discussed in that thread, but the not output is the most common one): http://swfupload.org/forum/generaldiscussion/872

Resources