cocos2dx and some kind of image cache - cocos2d-x

I am playing around with cocos2dx in Xcode and developing for iphone. My question concerns the creation of sprites from png images stored in the Resources folder. Images load and everything works good until I remove, say, mysprite.png from the Resources folder. cocos2d should give me some kind of error like file not found but it compiles well! And even loads mysprite.png somehow. It seems like the sprite I removed is still stored somewhere in some kind of cache. If one such cache exists, how can I clear that cache?

This is not because of cache. When Xcode compiles a project and creates an app bundle, it copies all the resources in the directory (which results in addition of all new resources and replacement of all the modified ones in that bundle but doesn't delete the resources that have been removed).
You can remove app from Simulator or your iPhone so that next time when the app is installed, the newly built app won't have resources that have been removed.

Related

Library assets not compiling when publishing for AIR

Yesterday I started messing around with Adobe Scout. It gave me a message that said that my function times are not accurate because I'm running a debug mode (in a file that is compiling as an AIR app) and to try compiling a published version first. Thus began my foray into the exciting world of AIR certificates and Windows Installer packages. I made certificate, published it, opened the published package, installed it, opened the resulting file, and found... fanfare ... a rectangle object I draw with AS3 and nothing else. When I test the movie (debug version) in AIR, it has the rectangle as well as a 20x20 map of tiles that are created at runtime from a bitmap that is blitted into 16x16 tiles.
Huh? Do I need to do something special when publishing for AIR to embed the library item? Anyone have this issue publishing to AIR where library assets are unavailable at runtime?
Of course I'll post code if anyone thinks they would like to see it, but it all works fine in flash player, fine (albeit slow) in Adobe AIR for Desktop (when testing), just missing library assets when published and installed via Windows installer.
update
for that matter, when I publish a swf for playback on the web or flash player, a similar thing: just a colored background (per my .fla file settings) but no rectangle and no blitted bmp tiles. Could I be executing code before something is loaded, and when it is in a debug mode, the setup takes longer, so things have time to get loaded before trying to execute? I've tried to avoid this, but maybe failed?
So, apparently making an .exe file or AIR app doesn't stand alone from the library components. Their is probably a way to embed them in the project, but for my purposes, I found that just making sure that the .exe and necessary .png files are in the same source file solved the issue. The problem was that my .exe file was automatically getting compiled and saved into a different folder, so I thought that folder must have all the needed files in it.
So, the bottom line is just that an .exe or AIR file, when published, won't automatically have the needed files in the right places. It still needs to point to the correct file location for those files.

Library items in flash reducing export speed

At first i was using [Embed] to load in textures for a game.
I then went through the process of moving all the assets into the library.
The program is working fine, however the "Exporting SWF" takes absolutely ages now. It seems like it's doing an awful lot to process these library assets or something.
Is there any way I could reduce this time?
I wish to avoid going back to Embed if I can.
This might change your workflow too drastically, but my method to avoid this issue is to compile using a code editor (my preference is FlashDevelop, but FDT or Flash Builder work too), and to include any assets authored in the Flash Professional IDE by pre-exporting them to an SWC.
It means there are two steps to perform a complete compilation: the first to export the assets from Flash Pro to SWC (which is still slow), and the second to actually compile the SWF using the SWC and your code (which is much quicker). If you edit your assets as often as your code, this won't save you time at all, but in my experience I'll make many more tweaks to the code once the assets are in place, and overall it saves me time.
To start doing this, you can export an SWC from Flash Pro by going to File > Publish Settings, then checking the 'SWC' option (and unchecking 'SWF'). You can set the SWC path to something convenient for your code editor. Then in FlashDevelop, for example, you would include the SWC in your project (right click and 'Add to Library'), which allows you to access any classes that were set to 'Export for ActionScript' in the Flash Library.
Once it's all set up, I use SHIFT-ALT-F12 to publish from Flash, then tab over to FlashDevelop where the changes will be picked up, ready to compile directly from there.

Could not load scene into memory. Your document may be damaged

today I opened my flash project in CS6 and after it opened in the output I receive this message: "Could not load scene into memory. Your document may be damaged." The only problem I saw was the flash component (textInput, and button) that I use for my project. They was transformed smaller and I can select them. :-o And the problem is that try to open the previous version of the project and I found the same error. I think the only problem is FLASH COMPONENT. How can I make everything like it was (flash component). Is something about library ?I saw in library the TextInput are appear like symbol of component (3cubes).
Thank you for help!
Possible causes / solutions:
Your .fla was originally authored on a computer with a different operating system. Try opening it on the computer it was created.
Your .fla might have been made with a different version of Flash. Make sure you are opening it in the same version of Flash.
Your .fla might have been corrupted. If you look in the folder and it says the file size is something like 7kb, then your .fla file is seriously corrupted. Hopefully you have backups if this is the case.
Unfortunately it doesn't work in some fast way so I had to change all my flash components in the library. After I changed, the new components was looked also strange. But I didn't receive that error again and I can go ahead with my project now. Thank you anyway...

as3 extended classes doesn't understand updates

I think my flash has a curse.
I use Flash Professional CS5.5 with Gaia FrameWork in my project. movieclips in the project have extended classes and the problem is that when I give new functionality to my classes they doesn't work in an build project. for example function s cann't be found, trace doesn't work and so on. All the old functionality works. When I change class name then it works fine. but then it happens again.
I made new project and coped all the content, but still it happens. I event rainstalled flash but nothing works.
What can I do?
Are you working from a network drive? Sometimes if your system time and the network time are out of sync Flash thinks your class files haven't changed and does not bother to recompile the latest changes.
When testing your project compile like this: Go to Control > Delete ASO files and test movie.
This option deletes the compiled cache and forces it to be rebuilt ...

AS3 Embedding assets - "Warning: Failed to parse corrupt data"

I've got an AS3 project where I'm trying to compile in several images, a soundtrack, and a video via [Embed] metadata. It's a product requirement that these be embedded, so network transfer is not an option.
I'm getting some really strange behavior - a sort of intermittent corruption of the compiled-in data. Sometimes after the project compiles, I run the swf and it closes immediately and writes "Warning: Failed to parse corrupt data" to the flash log. If I delete the binary and clean the project, sometimes it'll run fine after building it again. Sometimes it doesn't.
This is probably the strangest part about this problem, but sometimes when I see that error, I can physically move the video [Embed] lines to the end of the file, then clean the project, and it will build and run no problem. Sometimes I move them back to the beginning of the file and it builds and runs fine.
It kinda seems like it might be a bug in the compiler. Has anyone else experienced something similar? I'm targeting Flash 10.1 and using sprout (http://projectsprouts.org) to build my project. This is the mxmlc line that's being used to compile (mxmlc Version 4.1.0 build 16076):
mxmlc -as3 -static-link-runtime-shared-libraries=true -debug -default-background-color=#ffffff -default-size 712 400 -output=bin/ProjectName.swf -source-path+=.preprocessed/src -source-path+=.preprocessed/assets .preprocessed/src/ProjectName.as
I've tried both removing the -debug compiler option and adding the -optimize option, but no luck.
Everything is being ran through the GNU C preprocessor for some other tasks, so maybe I'll try removing the preprocessor stuff and hardcoding those variables...I'll try that and post the results tomorrow.
Any insight at all would be much appreciated. Thanks!
EDIT:
This project is going to be compiled dynamically with different assets being embedded into the same codebase, so switching to something like Flash Builder for compilation really isn't an option...it must be done via command-line mxmlc.
UPDATE:
Turns out the corrupted data message was due to images created with Photoshop's "Save for web" feature. If I save them outright as PNG images I don't get the message. However, the intermittent nature of the movie compiling properly still seems to be an issue. Now sometimes when the project is compiled it won't throw any compiler errors, but I get a blank flash player window. Right clicking in flash player shows a context menu with a message that says "Movie not loaded..." This doesn't appear to have anything to do with things being ran through CPP first.
[Screenshot]
This is apparently a bug in mxmlc under Mac OS X. After posting this, I observed some other really strange behavior, so I switched the whole codebase to Windows 7. Everything works as expected there (still using Project Sprouts as a build tool).
Flash builder is fine with it.
Can you separate your issue for video or music only, or issue is true for both includes?