FlexUnit4 in IntelliJ - apache-flex

When I try to run test with FlexUnit4 and IntelliJ, I get this error:
SecurityError: Error #2148: SWF file file:///C|/Users/LIC/Projects/ProgramJef/out/production/Flex%2DClient%2DTests/%5Fflexunit.swf cannot access local resource file:///C|/Users/LIC/Projects/ProgramJef/out/production/Flex%2DClient%2DTests/textLayout_1.1.0.604.swf. Only local-with-filesystem and trusted local SWF files may access local resources.
at flash.net::URLStream/load()
at flash.net::URLLoader/load()
at mx.core::CrossDomainRSLItem/load()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\CrossDomainRSLItem.as:240]
at mx.core::RSLListLoader/loadNext()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\RSLListLoader.as:184]
at mx.core::RSLListLoader/load()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\RSLListLoader.as:156]
at mx.preloaders::Preloader/initialize()[E:\dev\4.x\frameworks\projects\framework\src\mx\preloaders\Preloader.as:279]
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::initialize()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\SystemManager.as:1925]
at mx.managers::SystemManager/initHandler()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\SystemManager.as:2419]
I really wouldn't know what the problem is here, and I can't find anything on it online. Even on IntelliJ and FlexUnit4 there's not much to find...

You must allow the resulting SWF access to your file system. Set the Flashplayer trust settings in a file. On Linux this file must be in
~/.macromedia/Flash_Player/#Security/FlashPlayerTrust/
(for Windows there is a similar path somewhere) and create a file that lists the output path of your project, e.g.
/dev/myproject/target
/dev/anotherproject/target
In case 'target' is our output folder.

Did you set up your test sources folder right? In Project Settings under Modules, add Flex and click Flex and add Text Source Folders using the tree structure on the right hand side.
(IntelliJ 9.0.2)

Related

JavaFX Application not loading fxml files when exported to a jar file

I have just finished my first java project, however I can't seem to get it to build properly. It will load the initial fxml file that the whole calculator runs on, however when I try to add a holiday/break in the holiday/break menu a dialogpane is supposed to display so the user can fill information, but I keep getting a location not set error when I run the jar file in the cmd. It all works when I launch it in intellij but not in the jar.
This is how I have my files set up. I made a resource directory in the FinishedCalCulator project and marked it as the resource root
This is how I set the Location of the FXML file into the loader. This works when I run it in Intellij but not in the jar file.
Project Structure
Running through CMD
Invocation Target Exception/Location not set error
I have looked around and found a few posts talking about putting all of the fxml files into a resource file and I did that and got it working again in Intellij, but it still will not display the dialog panes when I try to add them. I'm not really sure what I am doing wrong here. I don't think I fully understand what I am doing wrong. Any help would be great.
To expand on my comment...
Answer
In your code you are calling getResource("/addHolidayDialog.fxml"). Your resource's filename, however, is AddHolidayDialog.fxml. Simply change the "a" in your code to "A" and your code should work.
Explanation
Running from Intellij
When you run your application from Intellij it uses the output files in the out/production/classes directory. In other words, the classes are not in a JAR file. When you call getClass().getResource("/addHolidayDialog.fxml") you will get a URL like:
file://C:/.../out/production/classes/addHolidayDialog.fxml
Which works on Windows despite the fact the file is actually named AddHolidayDialog.fxml because Windows has a case-insensitive file system.
Running from JAR
Then you export your project to a JAR and run it from there. Calling the same getResource code you will now get a URL (if the code worked) like:
jar:file://C:/.../your-application.jar!/addHolidayDialog.fxml
What your code actually returns from getResource, however, is null. According to the JAR file, the resource addHoldiayDialog.fxml doesn't exist. It'll happily tell you that AddHolidayDialog.fxml does exist, however. The reason for this being that a JAR file has a case-sensitive "file system".

QWebview examples: only runs in specific directory

I'm trying to create a Qt app with a webview. I started out with a very simple UI with nothing more than a QWebview. When trying ui->webview->SetUrl("http://google.com"); the application crashes on something with openssl.
Auto configuration failed
3348:error:0200107B:system library:fopen:Unknown error:.\crypto\bio\bss_file.c:169:fopen('c:cygwinhomeAdministrateurbuildslavefull-windows_xp_32buildgpac_extra_libs/c:cygwinhomeAdministrateurbuildslavefull-windows_xp_32buildgpac_extra_libs/ssl/openssl.cnf','rb')
3348:error:2006D002:BIO routines:BIO_new_file:system lib:.\crypto\bio\bss_file.c:174:
3348:error:0E078002:configuration file routines:DEF_LOAD:system lib:.\crypto\conf\conf_def.c:199:
I continues trying the examples. Domtraversal is one of the easier applications so i tried to build and run this. It works.
Changed the url to "https://gmail.com" which also works (so no ssl issues there).
When i run the debug or release .exe it works normally (qt's bin path is in my path var so there are no dll problems), but when i move the executable to say, my Desktop it does not run.
I've tried several different things:
when i have any tree with the same amount of folders up to "build-domtraversal-Desktop_Qt_5_0_2_MSVC2010_32bit-Debug" as the folder it is build in continues by release with the executable in it (so: c:/test/test/test/test/test/test/build-domtraversal-Desktop_Qt_5_0_2_MSVC2010_32bit-Debug/release/app.exe) it works
When i add folders inside the release folder (...-Debug/release/test/test/app.exe) it works
When i change the name of either "build-domtraversal-Desktop_Qt_5_0_2_MSVC2010_32bit-*" or release folders it does not work (exept for the end of the build folder name)
When i change the name of the app itself it works.
When i change the folder structure to D:/* it does not work
When i turn off shadow build it does not work anymore in debug mode either. Unless i move the output .exe back into a folder structure where it did work.
There must be a path somewhere in the .pro.user or somewhere else i haven't thought about. Can anyone point me in the right direction? Cause right now I'm starting to believe in magic...

Resource file is not included when packaging and publishing web role on windows azure

I want to deploy a web role on Windows Azure. The project contains a large resource file (in fact, a dictionary file with extension .dct).
After packaging with vs2010, I investigate the .cspkg file, no .dct files are included in the approot sub-directory. What may be the problem and how to solve?
Thanks and best regards!
You need to set it to Copy Local in the files properties. See this screenshot:
Edited to add: According to #Summer_More_More_Tea it wasn't the Copy Local property but rather setting the Build Action to 'Content', which specifies the file is not compiled but is included in the output.

generating swf files

I have a flex webservice project 'simpleWebApp' running on the tomcat server. The simpleWebApp.swf file generated is in the webapp root folder of tomcat and it executes perfectly when i double click on the simpleWebApp.swf file
now i need the generated simpleWebApp.swf file to run when placed anywhere, any location.
what i need to do?
Copy the .swf and .html file to a folder(say testApp) inside your server's deploy folder.Then access your application http://localhost:8080/testApp/.swf.This works perfectly for me.
You will need to have correct path to the server where you webservice will be located, it's better to have this as a variable and path it in the flash vars to your swf. Also you may need crossdomain.xml, to be able to access you server from flash in a case if anywhere != yourserver
Another way what i did is, in the flash builder i went to project/Export Release Build which Builds and export an optimized release-quality SWF file. now when i place release build folder anywhere, my swf file works.

Source from external Folder (linked Source) not appearing in Flex?

i have a Air Project in which i have added three extenal source folders.
but when i reopen project or strat flash builder again i get icon on those folder like this
but when i open the configuration for that project and try to validate the path and adding it again i get message like this
but the path is valid. proof is this pic
what could be possible error,,, is there any way that i when ever re-open project i get no warning and able to navigate through the linked source code. now i am doing it
1- deleting on of the linked folder
2- again adding that folder.
as for quick:
install flas builder 4.1
2.imort that project into workspace
3rd is using maven ;)
check your project files,
.actionScriptProperties
.flexProperties
.project
make all of them writeable. this issue occur when you get code from Visual Source Safe that the files are copied to local machine in read-only mode.

Resources