qickrooms / flex-mojos

Automatically exported from code.google.com/p/flex-mojos
0 stars 0 forks source link

Compilation with external resources #111

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I would like to be able to compile a SWF application with access to
external resources.
When I do it with Eclipse (FB compiler) that works and Eclipse create
compiled SWF in a specific Bin Folder .. And my SWF can access my assets.

Whereas when I compile with Flex Mojos I only have my SWF ... So my only
option (with flex mojo) is to embed my resources in my SWF application,
which is not desired ! 

Original issue reported on code.google.com by tibeto...@gmail.com on 24 Sep 2008 at 1:06

GoogleCodeExporter commented 9 years ago
You can include external resources and assets by putting them in 
src/main/resources, and then adding this 
code to your pom:
    <build>
        <plugins>
                     <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>resources</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
.....

In the next release of flex-mojos, you won't need to add the resources plugin 
reference to your pom, it will be 
run automatically. I will be adding this soon.

Original comment by RedB...@gmail.com on 24 Sep 2008 at 2:00

GoogleCodeExporter commented 9 years ago
May be we should add target folder to FlashPlayerTrust.  Like what is done on 
tests.

Original comment by velo...@gmail.com on 24 Sep 2008 at 2:07

GoogleCodeExporter commented 9 years ago
Actually, I tried with my Main.mxml in :
src/main/flex/
And with my resources in : 
src/main/resources 

In my Pom.xml I have this option : 
<build>
        <sourceDirectory>src/main/flex/</sourceDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>resources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
.
.
.

And anyway I still have an error accessing my resources [ at runtime ] 

Original comment by tibeto...@gmail.com on 24 Sep 2008 at 2:55

GoogleCodeExporter commented 9 years ago
Please, detail this "error accessing my resources [ at runtime ]"

VELO

Original comment by velo...@gmail.com on 24 Sep 2008 at 3:33

GoogleCodeExporter commented 9 years ago
My error in french :

[RPC Fault faultString="Error #2148: Le fichier SWF
file:///C|/synergiesv2/sources/trunk/synergies%2Dflex/target/synergies%2Dflex%2D
0.1%2DSNAPSHOT.swf
ne peut pas accéder à la ressource locale
file:///C|/synergiesv2/sources/trunk/synergies%2Dflex/target/assets/data/Employe
es.xml.
Seuls les fichiers SWF local-système de fichiers et les fichiers locaux de 
confiance
peuvent accéder aux ressources locales." faultCode="InvokeFailed" 
faultDetail="null"]
    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::invoke()
    at mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal::invoke()
    at mx.rpc.http::HTTPService/send()
    at mx.rpc.http.mxml::HTTPService/send()
    at com.asfusion.mate.actions.builders::HTTPServiceInvoker/run()
    at com.asfusion.mate.actions::AbstractAction/trigger()
    at com.asfusion.mate.actionLists::AbstractHandlers/runSequence()
    at com.asfusion.mate.actionLists::EventHandlers/fireEvent()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()
    at mx.managers::SystemManager/preloader_preloaderDoneHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.preloaders::Preloader/displayClassCompleteHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.preloaders::DownloadProgressBar/timerHandler()
    at mx.preloaders::DownloadProgressBar/initCompleteHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.preloaders::Preloader/dispatchAppEndEvent()
    at mx.preloaders::Preloader/appCreationCompleteHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()
    at mx.core::UIComponent/set initialized()
    at mx.managers::LayoutManager/doPhasedInstantiation()
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/callLaterDispatcher2()
    at mx.core::UIComponent/callLaterDispatcher()

Traduction : 
[RPC Fault faultString="Error #2148: SWF File 
file:///C|/synergiesv2/sources/trunk/synergies%2Dflex/target/synergies%2Dflex%2D
0.1%2DSNAPSHOT.swf
can not access local resource
file:///C|/synergiesv2/sources/trunk/synergies%2Dflex/target/assets/data/Employe
es.xml.
Only SWF Local-system files and trusted local files can access local resources. 
"
faultCode="InvokeFailed" faultDetail="null"]
    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::invoke()
    at mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal::invoke()
    at mx.rpc.http::HTTPService/send()
    at mx.rpc.http.mxml::HTTPService/send()
    at com.asfusion.mate.actions.builders::HTTPServiceInvoker/run()
    at com.asfusion.mate.actions::AbstractAction/trigger()
    at com.asfusion.mate.actionLists::AbstractHandlers/runSequence()
    at com.asfusion.mate.actionLists::EventHandlers/fireEvent()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()
    at mx.managers::SystemManager/preloader_preloaderDoneHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.preloaders::Preloader/displayClassCompleteHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.preloaders::DownloadProgressBar/timerHandler()
    at mx.preloaders::DownloadProgressBar/initCompleteHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.preloaders::Preloader/dispatchAppEndEvent()
    at mx.preloaders::Preloader/appCreationCompleteHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()
    at mx.core::UIComponent/set initialized()
    at mx.managers::LayoutManager/doPhasedInstantiation()
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/callLaterDispatcher2()
    at mx.core::UIComponent/callLaterDispatcher()

Original comment by tibeto...@gmail.com on 24 Sep 2008 at 3:37

GoogleCodeExporter commented 9 years ago
Logan,

His problem is not related to resource copy (but is important get resource copy 
working).

Can you fix resource copy and ping me when you are done?

VELO

Original comment by velo...@gmail.com on 24 Sep 2008 at 3:43

GoogleCodeExporter commented 9 years ago
This appears to be a security sandbox issue. Flex will now allow you to load 
local files off of disk and at the 
same time access the network. So you can either disable network access like 
this (flex-compiler plugin section 
of your pom):

<configuration>
    <useNetwork>false</useNetwork>
</configuration>

Or you can add a special security exception to your application so it can 
access local files and remote files. 
You want to be in the local-with-networking sandbox mentioned here:
http://livedocs.adobe.com/flex/3/html/help.html?content=05B_Security_04.html
You can do this by adding your target directory to the "always trust" section 
here:
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_man
ager04.html

Original comment by RedB...@gmail.com on 25 Sep 2008 at 7:36

GoogleCodeExporter commented 9 years ago
Using maven-resources-plugin ... Is there a way to write resource folder in
.actionScriptProperties in the tag :  <compilerSourcePath>

Beacause I would like Eclipse to see my resources ... And it doesn't for the 
moment.

Original comment by tibeto...@gmail.com on 26 Sep 2008 at 8:42

GoogleCodeExporter commented 9 years ago
Add as source folder.  Should work.

VELO

Original comment by velo...@gmail.com on 26 Sep 2008 at 1:10

GoogleCodeExporter commented 9 years ago
yes but, I think with maven we can define only One Source Folder ... Using
sourceDirectory option :

<build>
        <sourceDirectory>src/main/flex/</sourceDirectory>

.
.
.

Original comment by tibeto...@gmail.com on 26 Sep 2008 at 1:14

GoogleCodeExporter commented 9 years ago
There is a plan to write a maven plugin that will update your Flex Builder 
files to match your flex-mojos config, 
but that has not been done yet. In the meantime, you can add your 
src/main/resources folder as a source folder 
in Flex Builder manually.

You can have more than 1 source folder in flex-mojos. You use <sourceDirectory> 
if you have only one. You use 
<sourcePaths> if you need more than one. But in this case, you do not need more 
than one source folder in 
flex-mojos that I can see, just in Flex Builder.

Original comment by RedB...@gmail.com on 26 Sep 2008 at 1:37

GoogleCodeExporter commented 9 years ago
Ok thanks :) 

Original comment by tibeto...@gmail.com on 26 Sep 2008 at 2:00

GoogleCodeExporter commented 9 years ago
Fixed at revision 790

Now, any SWF compiled will be add to trusted sandbox.  This mimic flexbuilder 
defauld
behavior.  To disable you must set updateSecuritySandbox as false.

Original comment by velo...@gmail.com on 11 Oct 2008 at 12:58