{"action":"created","issue":{"url":"https://api.github.com/repos/myflashlab/easyAS-Worker/issues/1","repository_url":"https://api.github.com/repos/myflashlab/easyAS-Worker","labels_url":"https://api.github.com/repos/myflashlab/easyAS-Worker/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/myflashlab/easyAS-Worker/issues/1/comments","events_url":"https://api.github.com/repos/myflashlab/easyAS-Worker/issues/1/events","html_url":"https://github.com/myflashlab/easyAS-Worker/issues/1","id":143685217,"number":1,"title":"BitmapData as Worker parameter","user":{"login":"designkros","id":4900672,"avatar_url":"https://avatars.githubusercontent.com/u/4900672?v=3","gravatar_id":"","url":"https://api.github.com/users/designkros","html_url":"https://github.com/designkros","followers_url":"https://api.github.com/users/designkros/followers","following_url":"https://api.github.com/users/designkros/following{/other_user}","gists_url":"https://api.github.com/users/designkros/gists{/gist_id}","starred_url":"https://api.github.com/users/designkros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/designkros/subscriptions","organizations_url":"https://api.github.com/users/designkros/orgs","repos_url":"https://api.github.com/users/designkros/repos","events_url":"https://api.github.com/users/designkros/events{/privacy}","received_events_url":"https://api.github.com/users/designkros/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-26T10:02:30Z","updated_at":"2016-03-30T15:02:07Z","closed_at":null,"body":"Hi, I'm trying to use your easyAS-Worker to encode BitmapData to ByteArray and then upload to server and I'm having trouble with passing the BitmapData variable to the worker function.\r\n\r\nThis is the function itself\r\n```actionscript\r\n public function encodeImageAndSave(bmpData:BitmapData, url:String):void\r\n    {\r\n        thisCommand = arguments.callee;\r\n        //here is the encoding and uploading code\r\n    } \r\n```\r\nI'm calling the as shown in the example with the WorkerManager\r\n```actionscript\r\n    var wm:WorkerManager;\r\n    public function start(worker:Class):void\r\n    {\r\n        wm = new WorkerManager(worker, loaderInfo.bytes, this);\r\n        wm.start();\r\n        wm.addEventListener(Event.WORKER_STATE, onWorkerState);\r\n    }\r\n\r\n    private function onWorkerState(e:Event):void\r\n    {\r\n        if (wm.state == WorkerState.RUNNING)\r\n        {\r\n             wm.command(\"encodeImageAndSave\", onProgress, onResult, imageToUpload, urlToCall);\r\n        }\r\n    }\r\n```\r\nBut the encoding function didn't run at all and I'm getting Error #1034: Type Coercion failed: cannot convert Object@11bbbe3a1 to flash.display.BitmapData.\r\n\r\nAm I doing something wrong or it's just not possible to pass BitmapData as parameter?\r\n"},"comment":{"url":"https://api.github.com/repos/myflashlab/easyAS-Worker/issues/comments/203478186","html_url":"https://github.com/myflashlab/easyAS-Worker/issues/1#issuecomment-203478186","issue_url":"https://api.github.com/repos/myflashlab/easyAS-Worker/issues/1","id":203478186,"user":{"login":"designkros","id":4900672,"avatar_url":"https://avatars.githubusercontent.com/u/4900672?v=3","gravatar_id":"","url":"https://api.github.com/users/designkros","html_url":"https://github.com/designkros","followers_url":"https://api.github.com/users/designkros/followers","following_url":"https://api.github.com/users/designkros/following{/other_user}","gists_url":"https://api.github.com/users/designkros/gists{/gist_id}","starred_url":"https://api.github.com/users/designkros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/designkros/subscriptions","organizations_url":"https://api.github.com/users/designkros/orgs","repos_url":"https://api.github.com/users/designkros/repos","events_url":"https://api.github.com/users/designkros/events{/privacy}","received_events_url":"https://api.github.com/users/designkros/received_events","type":"User","site_admin":false},"created_at":"2016-03-30T15:02:07Z","updated_at":"2016-03-30T15:02:07Z","body":"Thank you for your answer. I was afraid I couldn't use BitmapData as parameter.\r\n\r\nMy original thought was to use the worker to serialize the BitmapData into a String using Base64 and then upload it to server because it uses lots of resources on mobile and the UI freezes during the process. Asynchronous encoding did the job instead of the worker."}}