I use Starling 1.6 with Adobe AIR 17.0
And now this error just jumps from no place(previous version runs well). It happens before the AssetManager load done.
Even if I just use this simple code:
var bgTexture:Texture = Texture.fromBitmapData(new EMBED(), false, false, scale);
The error in this line:
fromBitmapData(bitmap.bitmapData, generateMipMaps, optimizeForRenderToTexture, scale, format, repeat)
format = "bgra";
generateMipMaps = false;
optimizeForRenderToTexture = false;
scale = 2;
This error happens! I follow the starling scaffow-mobile project.
Can you please help me explain and guide me how to solve this? Ask if you need any more detail please.
Use Texture.fromBitmap();
instead of Texture.fromBitmapData()
Related
I am upgraiding a loader for external flash game(this loader is already written and it is working, but I have been using previous version of Flash Builder(not sdk!) to write it.
What I need is to see what classes of my code does not exist in the project... For now it just compiles everything with or without errors and does not shows any errors or warnings to me.
I think the example will show what I mean:
I have a working function wich compiles without errors:
protected function init(event:Event = null) : void
{
Living.movie.removeEventListener(Event.ADDED_TO_STAGE, this.init);
this.GamePlayer = Living.movie.parent.parent;
this.Map = this.GamePlayer.map;
this.Map.addEventListener(Event.REMOVED_FROM_STAGE, this.dispose);
}
I am making changes to this function:
protected function init(event:Event = null) : void
{
NotExistingClassOrVariable = OMGIT will compile and so on;
Living.movie.removeEventListener(Event.ADDED_TO_STAGE, this.init);
this.GamePlayer = Living.movie.parent.parent;
this.Map = this.GamePlayer.map;
this.Map.addEventListener(Event.REMOVED_FROM_STAGE, this.dispose);
}
and above function compiles without any errors too.... I can write anything inside a function body - it will compile(but it will not work ofcaurse)...
Please help me to solve this problem - trying to solve it already for 8 hours.
And sorry for my really bad english =(
Solved a problem by reinstalling flash builder. I do not know why it happened, but seem it was IDE bug.
i have tried add equalizer my online radio. i was used http://www.everyday3d.com/blog/index.php/2008/03/26/classic-sound-equalizer-in-flashas3/
flash source file . it's working fine when i am worked in flash ide. but on my server the equalizer doesnot show. but if the playing file is mp3 format it will worked but if we play the stream url it's not working. i dont know how can i fix this. i am using as3, i am new to flash. please help any one. thanks advance
the equalizer code
var es:EqualizerSettings = new EqualizerSettings();
es.numOfBars = 80;
es.height = 30;
es.barSize = 3;
es.vgrid = true;
es.hgrid = 2;
es.colorManager = new GradientBarColor(0xffff4444);
es.effect = EqualizerSettings.FX_REFLECTION;
var e:Equalizer = new Equalizer();
e.update(es);
e.x = 100;
e.y = 60;
addChild(e);
addEventListener(Event.ENTER_FRAME, e.render);
What Gio said, SoundMixer.computeSpectrum-based approach, such as the one linked in your question, suffers from security problems. But there are alternatives, for example check this code: http://wonderfl.net/c/euIb/read (some of stream URLs in it are dead, and it might not work right away - so try it with your own stream URL)
Im learning the new version of cocos2d-x 2.1.4
im porting cocos2d to x version , i want to port this section :
spriteSheet = [CCSpriteBatchNode
batchNodeWithFile:"foo.gif"];
player = [CCSprite spriteWithBatchNode:spriteSheet
rect:CGRectMake(0, 0, 30, 56)];
to :
spritSheet = CCSpriteBatchNode::create("foo.gif");
player = CCSprite::??? which function here ???();
reading here : http://www.cocos2d-x.org/projects/cocos2dx/wiki/API_Change_List_from_v1x_to_2x?version=2
CCSprite::spriteWithBatchNode(...) is removed, please use: sprite =
CCSprite::spriteWithTexture(batchNode->getTexture(), CCRect*);
batchNode->addChild(sprite); instead
but there is no spriteWithTexture in CCSprite
what is replacement ?
Well You can use this. They have modified the function calls
CCSprite *pSprite = CCSprite::createWithTexture(pTexture, rect);
I havent used it yet the latest cocos, but given the error it seems that you just need to do something like:
player = [CCSprite spriteWithTexture:[spriteSheet getTexture];
[spriteSheet addChild:player]
they just removed the spriteWithBatchNode init, but you can easly get the texture from a batchnode with getTexture
Hey so I am trying to create an air app that generates a PDF for the user to save but am running into issues with PurePDF. Whenever I run the ImageElement.getInstance() method I am returned a runtime error:
Error: Error #2030: End of file was encountered. at flash.utils::ByteArray/readUnsignedByte()
I am still just in the testing stage and am not evening doing anything crazy. This is what my code looks like:
var bd:BitmapData = new BitmapData( 1024,768 );
bd.draw(pdfClip); //A simple movieclip on the stage containing an image
var bytes:ByteArray = bd.getPixels(new Rectangle(1024,768));
var image:ImageElement = ImageElement.getInstance( bytes );
I would be grateful if anyone that has used purePDF can offer any advice, the documentation is extremely limiting.
You should use the "getBitmapDataInstance" instead, because the "getInstance" method is expecting a png encoded bytearray.
ImageElement.getBitmapDataInstance( bitmap );
see also this example:
https://code.google.com/p/purepdf/source/browse/examples/src/ImageBitmapData.as
For a project I want to show all available webcams and microphones, so that the user can easily select whichever webcam/microphone combination they prefer. I run into an issue with the microphones listing though.
Each microphone is listed with an activity animation and it's name. I am able to list all Microphones just fine (using the Microphone.names Array), but it seems like I can only get the activity viewer to work for one microphone. The other microphones show up with '-1' activity, which (as far as I know) is Flex for 'present, but not in use'. When unplugging the microphone that does show activity, the next one (in my case, the mic-in line on my motherboard) shows up with '0' activity (it's not connected, so that makes sense).
During my testing I have a total of 3 microphones available, the not-connected onboard mic-in port, and two connected microphones.
For testing purposes I use a timer that traces the current microphone activity each 100ms and the graph is also shown.
It does not seem to matter what default microphone I set via flash' settings panel.
The code
I've only attached the revelant code snippets below to make it easier for you to read through them. Please let me know if you prefer the entire code.
Main application.mxml
Note: cont is a VBox. i is defined before this code snippet.
var mics:Array = Microphone.names;
for(i=0; i < mics.length; i++){
var mic:settingsMicEntry = new assets.settingsMicEntry;
mic.d = {name: mics[i], index: i};
cont.addChild(mic);
}
assets/settingsMicEntry.mxml
timer is defined before this code snippet. the SoundTransform is added to silence local microphone playback. Excluding this code does not solve the problem, sadly (I've tried). display is an MXML Canvas object.
mic = Microphone.getMicrophone(d.index);
if(mic){
// Temporary: The Microphones' visualizer
var bar:Box = new Box();
bar.y = 50;
bar.height = 0;
bar.width = 66;
bar.setStyle("backgroundColor", 0x003300);
display.addChild(bar);
var tf:SoundTransform = new SoundTransform(0);
mic.setLoopBack(true);
mic.soundTransform = tf;
timer = new Timer(100);
timer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void{
var h:int = Math.floor((display.height/100)*mic.activityLevel);
bar.height = (h>-1) ? h : 0;
bar.y = (h>-1) ? display.height-h : display.height;
trace('TIMER: '+h+' from '+d.name);
});
timer.start();
}
I'm pulling my hear out here, so any help is much appreciated!
Thanks,
-Dave
Ps.: Pardon the messiness of the code!
You can set up a mock NetStream connection using the OSMF library.
You'll need to import the classes from the NetMocker project (under libs/adobe - org.osmf.netmocker) and the classes NetConnectionCodes and NetStreamCodes (under framework/OSMF - org.osmf.net).
Check out that you need to create one NetStream for each microphone