LibGDX: Particle in html project - libgdx

In desktop and Android is Ok but in Html not work and freezing in this line:
ParticleEffect particleEffect = new ParticleEffect();
articleEffect.load(Gdx.files.internal("particles/heart.p"), textureAtlas);

The js console gives you an error message.
Probably you are using a pre-1.9.10 particle effect with libgdx >= 1.9.10. The file format was changed, and while it was made backwards compatible on JVM platforms, this was not possible on HTML. You have to load and save the effect with the particle editor to solve this.

Related

as3 save swf stage to desktop - only works in IDE

I followed a tip here on saving the stage as a png (is there a way for flash AS3 to take a snapshot of a frame then save it as jpeg but using PNGEncoder instead). It works when run in Flash - I get a dialog box asking for where to save the file. But in a browser it just stalls out without showing the dialog box - and not running the code after that command. Are there security issues with using such code in a browser? Or is there something else going on here.
There are security issues with saving images - it has to be in response to a user action (ie mouse or keyboard event)

Create SWF video of images through Adobe Flex

I don't know whether it's the right place to put this up. But I've been trying from past 12 hours and haven't found anything related.
I'm creating a Adobe AIR project (which'll run on desktop), it'll ask for image locations on the local pc.
After the user is done selecting images. I want to output a SWF video (slideshow) of the selected images.
How to do the second step. Please guide. I want to create an output file (SWF) from my AIR Flex Desktop Application.
Check out https://github.com/claus/as3swf to compile SWFs at runtime...
This individual seems to have had a similar issue AS3 to Generate Dynamic SWF?
You can try following options from SWFtools
JPEG2SWF Takes one or more JPEG pictures and generates a SWF slideshow from them. Supports motion estimation compression (h.263) for better compression of video sequences.
PNG2SWF Like JPEG2SWF, only for PNGs.
GIF2SWF Converts GIFs to SWF. Also able to handle animated gifs.
Here is what I did :
Install the as3 compiler (mxmlc)
Run the command mxmlc.exe sample.as3 using NativeProcess

how do you find error in a SWF?

i feel stupid asking that question, but it seems like i'm unable to find out.
i have a SWF that works perfectly inside flash. once i export as SWF, it doesn't work anymore.
i can't use "trace"
i have tryed that function but it doesn't trigger it for some reason. :
function quikTrace(string:String){
//INIT VARIABLES
var tmpTxtField:TextField;
//TEXTFIELD PROPERTIES
tmpTxtField = new TextField();
tmpTxtField.text = string;
tmpTxtField.x = stage.width / 2;
tmpTxtField.textColor = 0xFFFFFF; //white (black background)
tmpTxtField.y = stage.height / 2;
addChild(tmpTxtField);
}
is there any "outside the box" way to find errors in a SWF?
You can view trace statements in the browser by doing a few quick steps:
Get a debug flash player for your browser. link
Set up mm.cfg to enable flash logging to a file. link
Get a text editor / "tail" viewer and read the flashlog.txt file that is generated. This is where FireBug & Flashbug come in handy, if you're in firefox. You can also try baretail for PC, or regular old "tail -f" on a mac/linux machine.
Good luck.
It's not a stupid question at all! You're just learning how to debug Flash for the first time. You can use "trace" with an exported SWF by doing a debug/test build from Flash IDE or Flash Develop. You can then read these traces with Firefox by using the extentions Firebug combined with the Flashbug extension. Now you're all set for getting feedback using traces.
For this particular problem, it's hard to say. Is this function inside of a class or timeline code? If it's a class, it probably because Stage is not ready yet. You can use the event Event.ADDED_TO_STAGE to know when the Stage reference is ready to be used.
Hope this helps!
Install a debug version of flash player for your browser. It will tell you exactly which line of code is throwing error.
http://www.adobe.com/support/flashplayer/downloads.html

3D transforms on loaded SWFs aren't working

Here's the scenario:
Our creative team produces SWF animations in the Flash CS5 authoring tool that we (the engineers) load at runtime into a project built using the Flex SDK. Animations that don't use the "3D rotation tool" work just fine.
Animations that use the 3D rotation tool give the following behavior:
MovieClips that have 3D tweens applied using the 3D rotation tool show up in the top-left corner of the stage as if they had no transform at all (i.e. as if their Matrix3D was being ignored, and their Matrix was identity)
MovieClips that have normal 2D tweens animate properly
Alpha and other non-affine properties tween properly
Both 3D and non-3D animations play fine when loaded by themselves in a browser tab or the standalone flash player. 3D is only broken when loaded into our code generated SWF.
So it seems that for MovieClips with 3D transformations applied in the CS5 authoring environment, those transformations aren't being applied / respected when the SWF is loaded by our code SWF.
This is my first foray into 3D, so I'm not sure what could be causing this, but here's what I've tested / checked / tried, all to no avail:
I've ensured that actionscript 3 and Flash Player 10 / 10.1 is selected in the authoring environment.
I've tried loading animations into code SWFs built using Flex 4.1, 4.5, and 4.6 at Flash player versions 10.0, 10.1, 10.2, and 11
I've applied Matrix3D to the containers that load the SWF animations, both identity and rotated. I can see the rotated containers do work with 3D in perspective, so I know that my code SWF is 3D capable.
I'm hoping there's some simple trick, some setup I'm missing. Thanks for your help!
This may be something that is going on in your Flex code, such as stopping the animations, or not starting them. Can you post the code that you use to load the SWFs?
This may be a race condition, too. You may have to wait until the SWFs are loaded (e.g., addedToStage events or the like) before using them.
I came across your problem because I had exactly the same issue... And after a lot of poking around, the solution (for me) boiled down to this:
If, at any point, you are strong-typing your CHILD swf to a class, or referring to any of its variables using dot syntax from the PARENT, it breaks. Even if it's just a trace message.
I had to replace this:
var stoneVideo:StoneVideo = loader.content as StoneVideo;
stoneVideo.stoneText = model.stoneText;
With this:
loader.content["stoneText"] = model.stoneText;
And it started working properly. Hope this helps!
I can't post code, but it turns out it was an overly cautious subtlety in our loader code that had never caught us before:
We have a custom class that loads all images for us (including a few utilities and common functionality built in). On load complete, this code took the loader.content, added it as a child to itself, and -- here's the kicker -- cleaned up the no-longer-necessary loader using close() and unloadAndStop().
I suppose it seemed rational to cleanup the loader in this way, and it has always worked until now (with static images, static SWFs, and SWF animations), but it caused the above issue upon loading 3D swfs (and it turns out this also caused odd URL not found errors on loading video SWFs).
Disabling the overly cautious Loader cleanup fixed my problem.

Accurate sound input in Actionscript?

I want to create a swf or air app that takes an input and displays a graphic representation of it.
The graphic side is fine for the moment, but its always using an mp3 for example
var sound:Sound = new Sound (new URLRequest("myMP3.mp3"));
- i want it to be able to take a 'live' audio feed. How would I do that and is there a better way than using the microphone input?
thanks
dai2
Microphone input is probably the easiest way and using flash player 10.1 or AIR 2.0 you can do this. Take a look at http://www.adobe.com/devnet/air/flex/articles/using_mic_api.html
It's not as easy as using SoundMixer.computeSpectrum but offers the possibility (+ more). You'll for instance most likely want to run the data through FFT to use in visualization