doublefx / easyworker Goto Github PK
View Code? Open in Web Editor NEWFlex / Air / Pure AS3 library to make ease to work with Workers
License: Apache License 2.0
Flex / Air / Pure AS3 library to make ease to work with Workers
License: Apache License 2.0
Hello!
First of all thank you for great library, it's really very useful and easy to use.
I'm trying to use the worker to download data from URL and save it to disk.
I create a thread like
thread = new Thread(FileDownloadWorker, "fileDownloadRunnable", true);
When I first call
thread.start(url, nativePath)
everything is fine, and I dispatch the result with
dispatcher.dispatchResult(url)
and get the result outside the thread.
But when I then try to download another file in the same way calling
thread.start(anotherUrl, anotherNativePath)
nothing happens. I get no errors, but no results at the same time.
Am I doing something wrong?
I have to create worker and use it in a
SQLConnection. So the multiple worker solution is not good for me.
How can I use again a thread, when it's result event is dispatched?
If I trace the state of the thread in the event handler method, the result is: started
Broken link:
http://www.sharebeast.com/er9n45ly0s8c
I am trying to make a Worker working with a mobile project. I am using Flex 4.13.0 and Air 14.
On the desktop it's working but on the mobilepone I don't understand why but it's not working.
Worker.isSupported give me TRUE, so that should be ok.
But when I am trying, it's like the worker never get the chance to start.
I am on FlashBuilder 4.7. I also tried FDT (free version) with the same result. With IntelliJ I get a debug class error, so I didn't try much on it.
I have this (from you example):
private function createWorker():void {
_thread = new Thread(ComplexWorker, "complexRunnable");
_thread.addEventListener(ThreadStateEvent.THREAD_STATE, onThreadState);
_thread.addEventListener(ThreadProgressEvent.PROGRESS, thread_progressHandler);
_thread.addEventListener(ThreadResultEvent.RESULT, thread_resultHandler);
_thread.addEventListener(ThreadFaultEvent.FAULT, thread_faultHandler);
//Start a Thread in Pause, click on Start to resume it.
_thread.start(new TermsVo(1, 2));
trace ('_thread.isNew: ' + _thread.isNew);
trace ('_thread.isPaused: ' + _thread.isPaused);
trace ('_thread.isPausing: ' + _thread.isPausing);
trace ('_thread.isResuming: ' + _thread.isResuming);
trace ('_thread.isRunning: ' + _thread.isRunning);
trace ('_thread.isStarting: ' + _thread.isStarting);
trace ('_thread.isTerminated: ' + _thread.isTerminated);
trace ('_thread.isTerminating: ' + _thread.isTerminating);
trace ('_thread.state: ' + _thread.state);
trace ('_thread.name: ' + _thread.name);
trace ('Worker.isSupported: ' + Worker.isSupported);
}
The traces give me this :
_thread.isNew: true
_thread.isPaused: false
_thread.isPausing: false
_thread.isResuming: false
_thread.isRunning: false
_thread.isStarting: false
_thread.isTerminated: false
_thread.isTerminating: false
_thread.state: new
_thread.name: complexRunnable
Worker.isSupported: true
The onThreadState event never fire.
I spend hours trying to understand and reading everything i can on internet.
I tried to add -swf-version=26 and -optimize=false but nothing works.
If you have any hint to share I will be very happy.
Thank you,
Seb
im using some fonts im Embedding via [Embed] tags
[ im embedding fonts as a symbol from another SWF ]
the worker way of doing it would be to use:
Worker.current.isPrimordial
but so far it seems it wont work ( im scouting the app and it is allocating memory on parseTag
method )
so, how do i prevent fonts from embedding on the worker thread?
or:
how do i check if the code is running on the worker or the thread?
thanks.
EDIT: i worked around it by loading the fonts using a Loader
When building the library with "Flex 4.12.1 AIR 14" I get the following message
1017: The definition of base class DebuggableWorker was not found.
A try easyWorker (web/desktop/mobile) with a simple example, but I always got this error message:
[Fault] exception, information=TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.doublefx.as3.thread::Thread$cinit()
at global$init()[/Volumes/Work/AS3/__TEST/EasyWorker/extsrc/com/doublefx/as3/thread/Thread.as:69]
at EasyWorker/startApp()[/Volumes/Work/AS3/__TEST/EasyWorker/src/EasyWorker.as:22]
at EasyWorker()[/Volumes/Work/AS3/__TEST/EasyWorker/src/EasyWorker.as:18]
//Main class
package {
import com.doublefx.as3.thread.Thread;
import com.doublefx.as3.thread.api.IThread;
import com.doublefx.as3.thread.event.ThreadFaultEvent;
import com.doublefx.as3.thread.event.ThreadProgressEvent;
import com.doublefx.as3.thread.event.ThreadResultEvent;
import flash.display.Sprite;
import model.TermsVo;
import workers.ComplexWorker;
public class EasyWorker extends Sprite {
private var _thread:IThread;
public function EasyWorker() {
startApp();
}
private function startApp():void {
_thread = new Thread(ComplexWorker, "nameOfMyThread");
_thread.addEventListener(ThreadProgressEvent.PROGRESS, thread_progressHandler);
_thread.addEventListener(ThreadResultEvent.RESULT, thread_resultHandler);
_thread.addEventListener(ThreadFaultEvent.FAULT, thread_faultHandler);
_thread.start(new TermsVo(1, 2));
}
private function thread_faultHandler(event:ThreadFaultEvent):void {
}
private function thread_resultHandler(event:ThreadResultEvent):void {
trace(event.result);
}
private function thread_progressHandler(event:ThreadProgressEvent):void {
}
}
}
//Worker class:
/**
* Created by varadig on 10/29/15.
*/
package workers {
import com.doublefx.as3.thread.api.CrossThreadDispatcher;
import com.doublefx.as3.thread.api.Runnable;
import model.TermsVo;
public class ComplexWorker implements Runnable {
// Mandatory declaration if you want your Worker be able to communicate.
// This CrossThreadDispatcher is injected at runtime.
public var dispatcher:CrossThreadDispatcher;
public function run(args:Array):void {
const values:TermsVo = args[0] as TermsVo;
dispatcher.dispatchResult(add(values));
}
private function add(obj:TermsVo):Number {
return obj.v1 + obj.v2;
}
}}
//TermsVO class
/**
* Created by varadig on 10/29/15.
*/
package model {
public class TermsVo {
public var v1:Number;
public var v2:Number;
public function TermsVo(v1:Number, v2:Number) {
this.v1 = v1;
this.v2 = v2;
}
}
}
When I load a ByteArray from a database its content is set to null. The other problem I have is when I add a property to a Model inheriting class I get them null.
Hi Frédéric
Have you had any issues with ReferenceErrors? I'm seeing the following two errors when trying to use easyWorker when embedded assets in the main swf.
Worker 2: [Fault] exception, information=ReferenceError: Error #1065: Variable PBPickingCollider_RayTriangleKernelClass is not defined.
Worker 2: [Fault] exception, information=ReferenceError: Error #1065: Variable MC_TestFLV is not defined.
PBPickingCollider_RayTriangleKernelClass is a pixelbender embed that is part of the away3d library:
public class PBPickingCollider extends PickingColliderBase implements IPickingCollider
{
[Embed("/../pb/RayTriangleKernel.pbj", mimeType="application/octet-stream")]
private var RayTriangleKernelClass:Class;
and MC_TestFLV is a MovieClip that is embedded in a swc that is included in the project. other than removing the embedded assets do you know of anyway to fix this issue?
Hi,
I tried using the pure as3 branch, but still got this error. Isn't this a Flex related class?
Cheers,
Timo
I use your library in a quite big project, and it's very handy !
However it doesn't always works when I deploy it without compiler option "optimize=false" (while it works in debug mode).
Unfortunately air package size is much more bigger when optimize=false, is there any way I can remove this option and still get the library work ? On some project, it works fine...
Hi Frédéric,
At first I would like to say thank you for the greate stuff you provided!
Unfortunately, I have an issue I can't resolve. I'm using the GraniteDS calsses inside worker. Everything works well except one thing. When I try to create org.granite.math.BigDecimal I get this error
[Fault] exception, information=ReferenceError: Error #1065: Variable org.granite.math::assert is not defined.
Due to the code of BigDecimal references to plain function org.granite.math::assert that is somehow not seen. I can't pass this name as extraDeps due to assert has Function type and not Class and defined like this.
package org.granite.math {
function assert(value:Boolean, message:String = null):void {
//...
}
}
Is it possible to somehow make it work?
Thanx in advance.
Hi Frédéric
I got the same issuse as this post:#3
I can get it worked by adding the compiler option -optimize=false,By I want to optimize the swf by the complier.So I change the code in Thread.as:
const file:FileReference = new FileReference();
file.save(swfBytes, "Worker.swf");
Save the swf in debug mode.Embed the swf.
create the worker by swf bytes:_worker = createWorkerFromSWF(swfBytes,workerDomain);
But it does not work in release version,
Any Idea? Thanks..
My worker is in a external swc file which is used in the main app compiled in the main swf.
I'm using easyWorker as an external swc lib in the main app.
Adobe FlashBuilder 4.7
Type.forName error: A class with the name 'com.doublefx.as3.thread.api.IProperty' could not be found. The class 'com.doublefx.as3.thread.api.IProperty' is probably an internal class or it may not have been compiled.
Type.forName error: A class with the name 'com.doublefx.as3.thread.api.SharableData' could not be found. The class 'com.doublefx.as3.thread.api.SharableData' is probably an internal class or it may not have been compiled.
Type.forName error: A class with the name 'com.doublefx.as3.thread.api.IDataProducer' could not be found. The class 'com.doublefx.as3.thread.api.IDataProducer' is probably an internal class or it may not have been compiled.
Type.forName error: A class with the name 'com.doublefx.as3.thread.util.AsynchronousDataManager' could not be found. The class 'com.doublefx.as3.thread.util.AsynchronousDataManager' is probably an internal class or it may not have been compiled.
Type.forName error: A class with the name 'com.doublefx.as3.thread.error.IllegalStateError' could not be found. The class 'com.doublefx.as3.thread.error.IllegalStateError' is probably an internal class or it may not have been compiled.
Type.forName error: A class with the name 'com.doublefx.as3.thread.error.UnsupportedOperationError' could not be found. The class 'com.doublefx.as3.thread.error.UnsupportedOperationError' is probably an internal class or it may not have been compiled.
Dep: de.gaia.model.marketplace.bases.interfaces.IDeserializeable tag: [82:DoABC] Lazy: true, Name: de/gaia/model/marketplace/bases/interfaces/IDeserializeable, Length: 634
Dep: de.gaia.model.marketplace.bases.interfaces.IAttributesMapped tag: [82:DoABC] Lazy: true, Name: de/gaia/model/marketplace/bases/interfaces/IAttributesMapped, Length: 401
Dep: de.gaia.model.marketplace.bases.interfaces.IBaseId tag: [82:DoABC] Lazy: true, Name: de/gaia/model/marketplace/bases/interfaces/IBaseId, Length: 968
Dep: de.gaia.model.marketplace.bases.interfaces.IBase tag: [82:DoABC] Lazy: true, Name: de/gaia/model/marketplace/bases/interfaces/IBase, Length: 1242
Dep: com.doublefx.as3.thread.api.Runnable tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/api/Runnable, Length: 450
Dep: de.gaia.watcher.DirectoryWatcher tag: [82:DoABC] Lazy: true, Name: de/gaia/watcher/DirectoryWatcher, Length: 7151
Dep: com.doublefx.as3.thread.event.ThreadFaultEvent tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadFaultEvent, Length: 1068
Dep: com.doublefx.as3.thread.api.IWorker tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/api/IWorker, Length: 616
Dep: com.doublefx.as3.thread.event.ThreadResultEvent tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadResultEvent, Length: 1073
Dep: com.doublefx.as3.thread.event.ThreadProgressEvent tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadProgressEvent, Length: 1378
Dep: com.doublefx.as3.thread.error.NotImplementedRunnableError tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/error/NotImplementedRunnableError, Length: 687
Dep: com.doublefx.as3.thread.event.ThreadActionResponseEvent tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadActionResponseEvent, Length: 1094
Dep: com.doublefx.as3.thread.event.ThreadActionRequestEvent tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadActionRequestEvent, Length: 828
Dep: de.gaia.model.marketplace.runner.bases.InfosBase tag: [82:DoABC] Lazy: true, Name: de/gaia/model/marketplace/runner/bases/InfosBase, Length: 1217
Dep: de.gaia.model.file.interfaces.IHash tag: [82:DoABC] Lazy: true, Name: de/gaia/model/file/interfaces/IHash, Length: 1084
Dep: de.gaia.model.file.Hash tag: [82:DoABC] Lazy: true, Name: de/gaia/model/file/Hash, Length: 1238
Dep: com.doublefx.as3.thread.api.CrossThreadDispatcher tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/api/CrossThreadDispatcher, Length: 1473
Dep: com.doublefx.as3.thread.util.ClassAlias tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/util/ClassAlias, Length: 549
Dep: com.doublefx.as3.thread.util.Closure tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/util/Closure, Length: 966
Dep: com.doublefx.as3.thread.util.DecodedMessage tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/util/DecodedMessage, Length: 676
[SWF]
Header:
Version: 25
Compression: None
FileLength: 34175
FileLengthCompressed: 34175
FrameSize: (550,400)
FrameRate: 50
FrameCount: 1
Tags:
[69:FileAttributes] AS3: true, HasMetadata: true, UseDirectBlit: false, UseGPU: false, UseNetwork: false
[64:EnableDebugger2] Password: null, Reserved: 0x1975
[09:SetBackgroundColor] Color: #ffffff
[77:Metadata] <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1">
<dc:format>application/x-shockwave-flash</dc:format>
<dc:title>Apache Flex Application</dc:title>
<dc:description>http://flex.apache.org/</dc:description>
<dc:publisher>Apache Software Foundation</dc:publisher>
<dc:creator>Apache Software Foundation</dc:creator>
<dc:language>en_US</dc:language>
<dc:date>Mar 22, 2018</dc:date>
</rdf:Description>
</rdf:RDF>
[65:ScriptLimits] MaxRecursionDepth: 1000, ScriptTimeoutSeconds: 60
[41:ProductInfo] ProductID: 3, Edition: 6, Version: 4.13 r20140701, CompileDate: Thu Mar 22 11:06:09 GMT+0100 2018
[43:FrameLabel] Name: ThreadRunner
[82:DoABC] Lazy: true, Name: de/gaia/model/marketplace/bases/interfaces/IDeserializeable, Length: 634
[82:DoABC] Lazy: true, Name: de/gaia/model/marketplace/bases/interfaces/IAttributesMapped, Length: 401
[82:DoABC] Lazy: true, Name: de/gaia/model/marketplace/bases/interfaces/IBaseId, Length: 968
[82:DoABC] Lazy: true, Name: de/gaia/model/marketplace/bases/interfaces/IBase, Length: 1242
[82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/api/Runnable, Length: 450
[82:DoABC] Lazy: true, Name: de/gaia/watcher/DirectoryWatcher, Length: 7151
[82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadFaultEvent, Length: 1068
[82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/api/IWorker, Length: 616
[82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadResultEvent, Length: 1073
[82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadProgressEvent, Length: 1378
[82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/error/NotImplementedRunnableError, Length: 687
[82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadActionResponseEvent, Length: 1094
[82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadActionRequestEvent, Length: 828
[82:DoABC] Lazy: true, Name: de/gaia/model/marketplace/runner/bases/InfosBase, Length: 1217
[82:DoABC] Lazy: true, Name: de/gaia/model/file/interfaces/IHash, Length: 1084
[82:DoABC] Lazy: true, Name: de/gaia/model/file/Hash, Length: 1238
[82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/api/CrossThreadDispatcher, Length: 1473
[82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/util/ClassAlias, Length: 549
[82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/util/ThreadRunner, Length: 7566
[82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/util/Closure, Length: 966
[82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/util/DecodedMessage, Length: 676
[76:SymbolClass]
Symbols:
[0] TagID: 0, Name: com.doublefx.as3.thread.util.ThreadRunner
[01:ShowFrame]
[00:End]
Thread start
[SWF] MarketPlace.swf - 34,175 bytes after decompression
VerifyError: Error #1014: Class mx.core::DebuggableWorker could not be found.
The "addition" example (TermsVo) does not work when debugging from FB 4. While I realize this is not exactly a supported IDE with Apache Flex 4.14, I'm not sure if this applies to all later versions of FB. This happens both debugging within AIR (16.0) and Flash (latest as of today), but the thread works fine on BOTH platforms when not attempting to attach the debugger (using Run).
Running the example, the Start button is disabled with thread "Running" and no result displayed. (debug mode) If not running in debug mode, the Start button is enabled and a result is displayed when clicked. Couldn't find any mention of this being a known issue anywhere.
Note - due to the broken swc download I had to compile the library myself; if doing something wrong there is a possible cause of the problem let me know and I'll look into it further.
I have a maven project that I am using FlexMojos to compile. When I specify the framework to be loaded as an RSL I receive the following runtime error. Im not sure if this is more of a FlexMojos issue or not, but maybe you and @chrisdutz could take a look? I've included the output of the error, as well as my pom. If I comment out the type configuration for the two dependencies under "RSL Dependencies", easyWorker works fine.
`4.0.0
<groupId>com.playground</groupId>
<artifactId>myArtifact</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>swf</packaging>
<name>myArtifact Flex</name>
<properties>
<flex.mojo.version>7.1.0</flex.mojo.version>
<flex.sdk.version>4.14.1</flex.sdk.version>
<flex.groupId>org.apache.flex</flex.groupId>
<flashplayer.version>20.0</flashplayer.version>
<flexunit.version>4.3.0-SNAPSHOT</flexunit.version>
<language>en_US</language>
</properties>
<build>
<sourceDirectory>src/main/flex</sourceDirectory>
<testSourceDirectory>src/test/flex</testSourceDirectory>
<plugins>
<plugin>
<groupId>net.flexmojos.oss</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>${flex.mojo.version}</version>
<extensions>true</extensions>
<configuration>
<optimize>false</optimize>
<generateHtmlWrapper>true</generateHtmlWrapper>
<debug>true</debug>
<templateURI>folder:${basedir}/html-template</templateURI>
<parameters>
<expressInstallSwf>playerProductInstall.swf</expressInstallSwf>
<useBrowserHistory>--</useBrowserHistory>
<bgcolor>#ffffff</bgcolor>
<version_major>11</version_major>
<version_minor>8</version_minor>
<version_revision>0</version_revision>
</parameters>
<sourceFile>Main.mxml</sourceFile>
<rslUrls>
<url>rsl/{artifactId}-{version}.{extension}</url>
</rslUrls>
<removeUnusedRsls>true</removeUnusedRsls>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.flex</groupId>
<artifactId>compiler</artifactId>
<version>4.14.1</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.adobe</groupId>
<artifactId>fontkit</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>generate-wrapper</id>
<goals>
<goal>wrapper</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<!-- This copies all of the flex rsls and puts them into the /rsl folder -->
<execution>
<id>copy-rsls</id>
<phase>process-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>${flex.groupId}.framework</includeGroupIds>
<includeTypes>swf</includeTypes>
<excludeTransitive>true</excludeTransitive>
<outputDirectory>${basedir}/target/rsl</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>${flex.groupId}</groupId>
<artifactId>framework</artifactId>
<version>${flex.sdk.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.adobe.flash.framework</groupId>
<artifactId>playerglobal</artifactId>
<version>${flashplayer.version}</version>
<type>swc</type>
</dependency>
<dependency>
<groupId>${flex.groupId}.flexunit</groupId>
<artifactId>flexunit-flex</artifactId>
<version>${flexunit.version}</version>
<type>swc</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.doublefx</groupId>
<artifactId>easyWorker</artifactId>
<version>0.0.1</version>
<type>swc</type>
</dependency>
<!-- RSL Dependencies -->
<dependency>
<groupId>org.apache.flex.framework</groupId>
<artifactId>framework</artifactId>
<version>${flex.sdk.version}</version>
<type>swc</type>
<scope>rsl</scope>
</dependency>
<dependency>
<groupId>org.apache.flex.framework</groupId>
<artifactId>framework</artifactId>
<version>${flex.sdk.version}</version>
<classifier>${language}.rb</classifier>
<type>swc</type>
<scope>rsl</scope>
</dependency>
</dependencies>`
[trace] Type.forName error: A class with the name 'com.doublefx.as3.thread.api.IProperty' could not be found. The class 'com.doublefx.as3.thread.api.IProperty' is probably an internal class or it may not have been compiled.
[trace] Type.forName error: A class with the name 'com.doublefx.as3.thread.api.SharableData' could not be found. The class 'com.doublefx.as3.thread.api.SharableData' is probably an internal class or it may not have been compiled.
[trace] Type.forName error: A class with the name 'com.doublefx.as3.thread.api.IDataProducer' could not be found. The class 'com.doublefx.as3.thread.api.IDataProducer' is probably an internal class or it may not have been compiled.
[trace] Type.forName error: A class with the name 'com.doublefx.as3.thread.util.AsynchronousDataManager' could not be found. The class 'com.doublefx.as3.thread.util.AsynchronousDataManager' is probably an internal class or it may not have been compiled.
[trace] Type.forName error: A class with the name 'com.doublefx.as3.thread.error.IllegalStateError' could not be found. The class 'com.doublefx.as3.thread.error.IllegalStateError' is probably an internal class or it may not have been compiled.
[trace] Type.forName error: A class with the name 'com.doublefx.as3.thread.error.UnsupportedOperationError' could not be found. The class 'com.doublefx.as3.thread.error.UnsupportedOperationError' is probably an internal class or it may not have been compiled.
[trace] Dep: com.doublefx.as3.thread.api.Runnable tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/api/Runnable, Length: 456
[trace] Dep: com.test.ComplexWorker tag: [82:DoABC] Lazy: true, Name: com/test/ComplexWorker, Length: 921
[trace] Dep: com.doublefx.as3.thread.api.IWorker tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/api/IWorker, Length: 617
[trace] Dep: com.doublefx.as3.thread.event.ThreadFaultEvent tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadFaultEvent, Length: 1074
[trace] Dep: com.doublefx.as3.thread.event.ThreadProgressEvent tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadProgressEvent, Length: 1384
[trace] Dep: com.doublefx.as3.thread.event.ThreadResultEvent tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadResultEvent, Length: 1079
[trace] Dep: com.doublefx.as3.thread.event.ThreadActionRequestEvent tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadActionRequestEvent, Length: 834
[trace] Dep: com.doublefx.as3.thread.event.ThreadActionResponseEvent tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadActionResponseEvent, Length: 1100
[trace] Dep: com.doublefx.as3.thread.error.NotImplementedRunnableError tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/error/NotImplementedRunnableError, Length: 693
[trace] Dep: com.doublefx.as3.thread.api.CrossThreadDispatcher tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/api/CrossThreadDispatcher, Length: 1477
[trace] Dep: com.doublefx.as3.thread.util.ClassAlias tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/util/ClassAlias, Length: 555
[trace] Dep: com.doublefx.as3.thread.util.DecodedMessage tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/util/DecodedMessage, Length: 682
[trace] Dep: com.doublefx.as3.thread.util.Closure tag: [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/util/Closure, Length: 973
[trace] [SWF]
[trace] Header:
[trace] Version: 28
[trace] Compression: None
[trace] FileLength: 20652
[trace] FileLengthCompressed: 20652
[trace] FrameSize: (550,400)
[trace] FrameRate: 50
[trace] FrameCount: 1
[trace] Tags:
[trace] [69:FileAttributes] AS3: true, HasMetadata: true, UseDirectBlit: false, UseGPU: false, UseNetwork: false
[trace] [64:EnableDebugger2] Password: null, Reserved: 0x1975
[trace] [09:SetBackgroundColor] Color: #ffffff
[trace] [77:Metadata] <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
[trace] <rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1">
[trace] dc:formatapplication/x-shockwave-flash/dc:format
[trace] dc:titlemyArtifact Flex/dc:title
[trace] dc:languageen_US/dc:language
[trace] dc:date6/21/16 3:07 PM/dc:date
[trace] /rdf:Description
[trace] /rdf:RDF
[trace] [65:ScriptLimits] MaxRecursionDepth: 1000, ScriptTimeoutSeconds: 60
[trace] [41:ProductInfo] ProductID: 3, Edition: 6, Version: 4.14 r20150325, CompileDate: Tue Jun 21 15:07:24 GMT-0600 2016
[trace] [43:FrameLabel] Name: ThreadRunner
[trace] [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/api/Runnable, Length: 456
[trace] [82:DoABC] Lazy: true, Name: com/test/ComplexWorker, Length: 921
[trace] [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/api/IWorker, Length: 617
[trace] [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadFaultEvent, Length: 1074
[trace] [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadProgressEvent, Length: 1384
[trace] [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadResultEvent, Length: 1079
[trace] [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadActionRequestEvent, Length: 834
[trace] [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/event/ThreadActionResponseEvent, Length: 1100
[trace] [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/error/NotImplementedRunnableError, Length: 693
[trace] [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/api/CrossThreadDispatcher, Length: 1477
[trace] [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/util/ThreadRunner, Length: 7568
[trace] [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/util/ClassAlias, Length: 555
[trace] [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/util/DecodedMessage, Length: 682
[trace] [82:DoABC] Lazy: true, Name: com/doublefx/as3/thread/util/Closure, Length: 973
[trace] [76:SymbolClass]
[trace] Symbols:
[trace] [0] TagID: 0, Name: com.doublefx.as3.thread.util.ThreadRunner
[trace] [01:ShowFrame]
[trace] [00:End]
[trace] Thread start
[trace] Thread State: running
[Fault] exception, information=VerifyError: Error #1014: Class mx.core::DebuggableWorker could not be found.
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at flash.tools.debugger.concrete.DManager.getFrame(DManager.java:927)
at flash.tools.debugger.concrete.PlayerSession.pullUpActivationObjectVariables(PlayerSession.java:1119)
at flash.tools.debugger.concrete.PlayerSession.requestFrame(PlayerSession.java:1095)
at flash.tools.debugger.concrete.PlayerSession.getValueWorker(PlayerSession.java:1217)
at flash.tools.debugger.concrete.IsolatePlayerSession.getValue(IsolatePlayerSession.java:127)
at flex.tools.debugger.cli.ExpressionContext.memberNamed(ExpressionContext.java:444)
at flex.tools.debugger.cli.ExpressionContext.locateParentForNamed(ExpressionContext.java:546)
at flex.tools.debugger.cli.ExpressionContext.determineContext(ExpressionContext.java:496)
at flex.tools.debugger.cli.ExpressionContext.resolveToVariable(ExpressionContext.java:356)
at flex.tools.debugger.cli.ExpressionContext.lookup(ExpressionContext.java:175)
at flash.tools.debugger.expression.DebuggerEvaluator.evaluate(DebuggerEvaluator.java:164)
at macromedia.asc.parser.ThisExpressionNode.evaluate(ThisExpressionNode.java:32)
at flash.tools.debugger.expression.DebuggerEvaluator.evaluate(DebuggerEvaluator.java:1033)
at macromedia.asc.parser.ListNode.evaluate(ListNode.java:42)
at flash.tools.debugger.expression.DebuggerEvaluator.evaluate(DebuggerEvaluator.java:1033)
at macromedia.asc.parser.ListNode.evaluate(ListNode.java:42)
at flash.tools.debugger.expression.DebuggerEvaluator.evaluate(DebuggerEvaluator.java:1067)
at macromedia.asc.parser.ExpressionStatementNode.evaluate(ExpressionStatementNode.java:48)
at flash.tools.debugger.expression.DebuggerEvaluator.evaluate(DebuggerEvaluator.java:1308)
at macromedia.asc.parser.ProgramNode.evaluate(ProgramNode.java:78)
at flash.tools.debugger.expression.DebuggerExpression.evaluate(DebuggerExpression.java:111)
at flex.tools.debugger.cli.ExpressionCache.evaluate(ExpressionCache.java:109)
at flex.tools.debugger.cli.DebugCLI.evalExpression(DebugCLI.java:3661)
at flex.tools.debugger.cli.DebugCLI.evalExpression(DebugCLI.java:3654)
at flex.tools.debugger.cli.DebugCLI.doPrint(DebugCLI.java:3593)
at flex.tools.debugger.cli.DebugCLI.processLine(DebugCLI.java:6318)
at flex.tools.debugger.cli.DebugCLI.process(DebugCLI.java:781)
at flex.tools.debugger.cli.DebugCLI.execute(DebugCLI.java:630)
at flex.tools.debugger.cli.DebugCLI.main(DebugCLI.java:401)
Hi Frédéric,
When I export an application using easyWorker it seems like threads are never responding. I don't know if they are ran or not, but I am sure that I never get the result. Try publishing https://github.com/riadvice/easyWorker-ActiveAIRCord/ with Flash Builder and run the application.
I used Adobe Scout but it seems like it does not handle workers.
Should I build the application using GradleFX or FlexMojos if it is a Flash Builder issue ? Normally they use the same Flex jar compiler.
Any idea ?
Hi,
There any way to use an ArrayCollection in a worker?
I know that is not a good practice to do it, but I would like to pass a complex custom object to the worker and it has a lot of ArrayCollection
Thank you very much
In your sample there is a TermVo.
But If I pass this value object:
_thread.start(new TermsVo(1,2));
and in the worker try to cast the args[0] to TermsVo:
const values:TermsVo = args[0] as TermsVo;
the values is equal to null.
with hard casting?
const values:TermsVo = TermsVo(args[0]);
ThreadRunner dispatchError: Error #1034: Type Coercion failed: cannot convert Object@95223d1 to workers.vo.TermsVo.
What I do wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.