haXe Forum > Flash hardware optimization
-
volatile Dec 11 at 18:40
Hello. It is possible to enable or change (wmode to direct/gpu) from haxe?
-
Philipp Klose Dec 13 at 03:03
You could toogle between fullscreen und normal mode as in very AS3 written FlashMovie.
You could really perform some graphical operations on the GPU... have a look at the following links: http://ncannasse.fr/blog/pixel_bender_assembler and http://labs.adobe.com/technologies/pixelbender/ -
Scott Campbell Dec 23 at 20:01
@ philipp
I think he's referring to the embed parameters.
etcSorry if im a few days late, but haxe has the same api as flash's... however it does have a few advantages over as3 such as inline functions, and the memory byte codes. But i don't think the actual flash player can change the wmode parameter on the fly... would probably raise too many security issues such as modifying script access.
<param name="allowScriptAccess" value="always" />
This would be important to sites where users can upload there own flash content, by doing this a user could potentially inject Javascript and start doing nasty things like session hi-jacking and redirecting visitors.
However i may be wrong... maybe there is something in the api that will let you change the wmode, but i doubt it.... but still worth investigating.
-
Scott Campbell Dec 23 at 20:11
Sorry to double post, but..
I just thought of a work around, you could write a javascript button to place next to your flash content that would change the wmode and reload the flash content. I'ld try google around and see how those other scripts do it like swfobject.
or if you have script access, you could place the button inside of flash.
As a last resort you could use an iframe in conjunction with the javascript, if your still having trouble reloading it.
-
jan Dec 23 at 23:12
I wrote a little script a week or so ago as a reply to a question on the mailing list on how to change the script timeout seconds of a compiled swf. I've quickly added a few lines so you can also change what you are after. It's all hard coded and you must compile it again when you want other values. I'll add some other stuff like background color etc in the future and make it more dynamic so you can use arguments from commandline, but for the time being I guess it'll do the trick.
Download the format lib:haxelib install format
Then compile with:SetTimeout -main SetTimeout -neko settimeout.n -lib format #-cmd neko settimeout.n
Put the compiled settimeout.n file together with movie.swf in a folder and run with:neko settimeout
import format.swf.Data; import format.swf.Reader; import format.swf.Writer; import haxe.io.Bytes; import haxe.io.BytesInput; import haxe.io.BytesOutput; import neko.io.File; class SetTimeout { public static function main() { var swfBytesInput = new BytesInput(File.getBytes('movie.swf'));//input swf var swfReader = new Reader(swfBytesInput); var header = swfReader.readHeader(); var tags = swfReader.readTagList(); swfBytesInput.close(); var data = new BytesOutput(); data.bigEndian = false; data.writeUInt16(256);//maxRecursionDepth data.writeUInt16(15);//scriptTimeoutSeconds tags.unshift(TUnknown(0x41, data.getBytes())); for(i in 0...tags.length) { switch(tags[i]) { case TSandBox(v): tags[i] = writeTSandBox(); default: } } var swfBytesOutput = new BytesOutput(); new format.swf.Writer(swfBytesOutput).write({header:header, tags:tags}); var fout = File.write('out.swf',true);//output swf fout.write(swfBytesOutput.getBytes()); fout.close(); } public static function writeTSandBox():SWFTag { var outp = new haxe.io.BytesOutput(); var bits = new format.tools.BitsOutput(outp); bits.writeBit(false); bits.writeBit(false);//useDirectBlit bits.writeBit(false);//useGPU bits.writeBit(false);//hasMetaData bits.writeBit(true);//actionscript3 bits.writeBits(2, 0); bits.writeBit(false);//useNetwork bits.writeBits(24, 0); return TSandBox(new BytesInput(outp.getBytes()).readUInt30()); } }
Cheers,
Jan