In peiodic task i set iconic tile:
var tile = ShellTile.ActiveTiles.FirstOrDefault();
if(tile!=null)
tile.Update(new IconicTileData{ Count= 1, IconImage=..., SmallIconImage=..., Title="test"});
It works, and i see "1" on tile.
After that, in mainpage of app at startap i'm trying to clear it like(without count):
var tile = ShellTile.ActiveTiles.FirstOrDefault();
if(tile!=null)
tile.Update(new IconicTileData{ IconImage=..., SmallIconImage=..., Title="test" });
Then i exit app, but "1" remains on tile, why? No exception thrown.
While updating the tile, if you want count not to be displayed, set count=0
Related
I am trying to mask an image on another so that I only view the specific portion of the unmasked image through the masked one. My problem is that I cannot see anything on the screen.. no Image, no effect at all
cardMask = new Image(Root.assets.getTexture("card_mask"));
cardMask.y = Constants.STAGE_HEIGHT*0.40;
cardMask.x = Constants.STAGE_WIDTH *0.48;
trace("it's add mask");
cardLight = new Image(Root.assets.getTexture("card_light_mask"));
cardLight.y = Constants.STAGE_HEIGHT*0.46;
cardLight.x = Constants.STAGE_WIDTH *0.48;
cardLight.mask=cardMask;
maskedDisplayObject = new PixelMaskDisplayObject(-1,false);
maskedDisplayObject.addChild(cardLight);
maskedDisplayObject.x=cardLight.x;
maskedDisplayObject.y=cardLight.y;
maskedDisplayObject.mask=cardMask;
maskedDisplayObject.blendMode = BlendMode.SCREEN;
addChild(maskedDisplayObject);
First, for masking an object the mask object should also be added to the display list. Your code does not add cardMask to display list anywhere. Second, if your maskedDisplayObject should be visible at all times, the mask should be assigned not to it, but to some other object which displayed part you desire to control. And third, it is also possible that this.stage is null, therefore the entire tree (this -> maskedDisplayObject -> cardLight) is plain not rendered. You need to check all three of these conditions to get something displayed.
Also, if you desire cardLight as an object to move independently of maskedDisplayObject, you should add it to this instead, and check that it's displayed on top of maskedDisplayObject (call addChild(cardLight) after addChild(maskedDisplayObject)).
This all totals to this code:
trace("Stage is null:", (this.stage==null)); // if this outputs true, you're out of display
cardMask = new Image(Root.assets.getTexture("card_mask"));
cardMask.y = Constants.STAGE_HEIGHT*0.40;
cardMask.x = Constants.STAGE_WIDTH *0.48; // mask creation unaltered
trace("it's add mask");
cardLight = new Image(Root.assets.getTexture("card_light_mask"));
cardLight.y = Constants.STAGE_HEIGHT*0.46;
cardLight.x = Constants.STAGE_WIDTH *0.48;
cardLight.mask=cardMask; // this is right
maskedDisplayObject = new PixelMaskDisplayObject(-1,false);
// maskedDisplayObject.addChild(cardLight); this is moved to main part of display list
maskedDisplayObject.x=cardLight.x;
maskedDisplayObject.y=cardLight.y;
// maskedDisplayObject.mask=cardMask; NO masking of this, you're only masking cardLight
cardLight.blendMode = BlendMode.SCREEN; // display mode is also changed
addChild(maskedDisplayObject);
addChild(cardLight);
I have a song chopped up into 4 pieces: intro, A, B, ending. I have a program that plays the intro, then the A two times then B two times then back to A again and keeps repeating AABB until I press the ending button. If the ending button is pressed, it finishes the currently playing song piece, plays the ending and stops. It works like a charm except there is a very noticeable, irritating delay in the transition between the song pieces. How can I get rid of the delay and make it play the song pieces right after the previous piece ends? (I'm using actionscript 3.0 in flash cs6, the song pieces are in mp3 format, imported into the library).
Here's the program:
https://dl.dropboxusercontent.com/s/6f9w906x9uja683/Loop%20music%20test.swf
And here's the code I'm using:
import flash.events.MouseEvent;
stop();
//variables
var track_var: Number = 0;
var music_cnl:SoundChannel = new SoundChannel();
var intro_msc:Sound = new intro_mp3();
var a_msc:Sound = new A_mp3();
var b_msc:Sound = new B_mp3();
var outro_msc:Sound = new ending_mp3();
//stopping the movieclips
a_mc.stop();
b_mc.stop();
ending_btn.stop();
//intro
music_cnl = intro_msc.play();
track_var= 1;
intro_mc.gotoAndStop(2);
music_cnl.addEventListener(Event.SOUND_COMPLETE, playnext_fn);
trace("debug:track value set to",track_var);
//track selector
function playnext_fn(event:Event){
trace("debug:playnext_fn called");
switch(track_var){
case 0:
//stop
music_cnl.stop();
intro_mc.gotoAndStop(1);
a_mc.gotoAndStop(1);
b_mc.gotoAndStop(1);
ending_btn.gotoAndStop(1);
trace("debug:track value set to",track_var);
ending_btn.removeEventListener(MouseEvent.MOUSE_UP, ending_fn);
break;
case 1:
//first A track
track_var=2;
intro_mc.gotoAndStop(1);
b_mc.gotoAndStop(1);
a_mc.gotoAndStop(2);
music_cnl= a_msc.play();
music_cnl.addEventListener(Event.SOUND_COMPLETE, playnext_fn)
trace("debug:track value set to",track_var);
break;
case 2:
//second A track
track_var=3;
music_cnl= a_msc.play();
music_cnl.addEventListener(Event.SOUND_COMPLETE, playnext_fn);
trace("debug:track value set to",track_var);
break;
case 3:
//first B track
track_var = 4
a_mc.gotoAndStop(1);
b_mc.gotoAndStop(2);
music_cnl= b_msc.play();
music_cnl.addEventListener(Event.SOUND_COMPLETE, playnext_fn);
trace("debug:track value set to",track_var);
break;
case 4:
//second B track
track_var=1;
music_cnl= b_msc.play();
music_cnl.addEventListener(Event.SOUND_COMPLETE, playnext_fn);
trace("debug:track value set to",track_var);
break;
case 5:
//ending
a_mc.gotoAndStop(1);
b_mc.gotoAndStop(1);
intro_mc.gotoAndStop(1);
ending_btn.gotoAndStop(2);
music_cnl=outro_msc.play();
track_var=0;
music_cnl.addEventListener(Event.SOUND_COMPLETE, playnext_fn);
trace("debug:track value set to",track_var);
break;
}
}
//ending button
ending_btn.addEventListener(MouseEvent.MOUSE_UP, ending_fn);
function ending_fn(Event:MouseEvent){
track_var=5;
ending_btn.gotoAndStop(2)
trace("debug: ending button pressed|","track value set to",track_var);
}
I don't see a problem with your code (other than the redundant and incorrect syntax regarding
MAX_BUFFERSIZE, but I think this just looks like remnants of trying to resolve the problem!)
What I think is more likely to be causing the problem is your source audio - if it's imported as an MP3, or with a bitrate of 48 this can cause problems with synching.
You can't get rid of the delay using traditional Sound object whether from library, loaded externally, mp3, wav, any bite rate. The Flash Sound API suffers from a bad design and latency is inevitable when playing sounds.
However in your case you might be abe to get away with it by using the SampleEventData and mix together all your tracks. The initial latency can go up to 1000ms but in your case that might be irrelevant since the sync between sound is more important:
http://help.adobe.com/en_US/as3/dev/WSE523B839-C626-4983-B9C0-07CF1A087ED7.html
When playing Sounds in Flash in ANY WAY the latency (the time it takes for the sound to start playing) can go from 60ms to 400ms depending on the system. The recommended industry standard is 30ms making Flash an obsolete technology for any Sound related applications.
I have a webpage(HTML 5) in which there are 4 charts, each of which taking different time to load once the static content in the page comes up. The Loading is shown in the webpage using a 'rendering' circle image for all the 4 charts. I want to find out how much time each of the charts were showing the 'rendering' circle. Please help me in getting a solution using selenium webdriver.
It is the crude way but it must work.
Create a infinite loop with 1 second wait and in each iteration check if the chart is loaded or not. Once all four charts are loaded or if you have timeout value come out of loop.
In this case there is possibility of error of 1 sec. If your chart is loading fast or want to reduce the margin of error reduce the wait from 1 sec to 100msec.
Pseudo code :[May use this to write better code]
boolean[] chartLoaded = {false,false,false,false};
int[] chartLoadTime = {0,0,0,0};
int counter = 0;
while(counter < 100)
{
counter++;
if(isLoaded(chart1))
{
chartLoaded[0] = true;
chartLoadTime[0]++;
}
//Do this for other three charts also
if(chartLoaded[0] && chartLoaded[1] && chartLoaded[2] && chartLoaded[3])
break;
}
I'm creating a memory like game. I built all the desktop, the cards generation. I now have two cards of each.
I'm trying to do the pairs delete system.
my function to show the color to find looks like this :
private function onClick(e:MouseEvent):void
{
if (vueDos)
{
vueDos = !vueDos;
faceCarte = new Sprite();
faceCarte.graphics.lineStyle(2,0x000000,.5);
faceCarte.graphics.beginFill(clr);
faceCarte.graphics.drawRoundRect(8,8,this.width - 16, this.height - 16, 10,10);
faceCarte.graphics.endFill();
var _t:TextField = new TextField();
_t.selectable = false;
_t.antiAliasType = "advanced";
_t.autoSize = "left";
_t.defaultTextFormat= new TextFormat(maFont.fontName,24,0x000000);
_t.text = couleur;
_t.x = (this.width - _t.width)/2
_t.y = (this.height - _t.height) >> 1;
faceCarte.addChild(_t);
faceCarte.cacheAsBitmap = true;
this.addChild(faceCarte);
}
if(!vueDos)
}
Does it exist a function wich see if the color of the card is visible (faceCarte), and limit the visibles carte to two then removeChild faceCart.
Thank you in advance
You have to make such a function yourself. It'll be better to assign a couleur property to the card itself, instead of putting it into the TextField and forgetting. This way you'll be able to open first card, get that property, then open second card and compare that one's property with what you received, if match, both cards will be removed.
I'm new to starling and this may sound like a noob question but here goes nothing.
Imagine the following scenario (in Flash):
A movieclip named test
Test has 80 frames
Test has 4 labels at 20 frames each
When I script test in my project. I make it loop from label 0-1 (frames 1-19). Then I tell it to loop on label 2 on a certain event.
This way, I do not add or remove a movieclip or instantiate things just one.
Now, if I think about implementing it in starling. I'm thinking make 4 movieclips in flash. Export them as sprite sheets and then make four movieclips in the script. Add whichever moviclip needs to play in the juggler and similarly removechild it at that time.
This way, I'm adding the overhead cost of 'addchild' and 'removechild' everytime I want to switch between those animations. Is that a more cost effective way?
I presume you want to export a single clip, but control multipe(4 animations) rather than a single one. If this is the case, I wrote a few JSFL scripts a couple of years ago (when CS6 wasn't around to export spritesheets) which exported the main timeline of an .fla document as an image sequence, but used the frame labels in the filenames. This made it easy to integrate with TexturePacker. You can see video of it here.
Here's a JSFL snippet which will export a frame sequence with names generated based frame labels which should make it easy to manage in TexturePacker:
var d = (FLfile.getPlatform() == 'macos') ? '/' : '\\'; //delimiter
var doc = fl.getDocumentDOM(); //document
var tl = doc.getTimeline();tl.setSelectedLayers(0,true); //timeline
var cl = tl.layers[0]; //current layer
var numFrames = cl.frameCount;
var className = prompt("Name for your sequence", toClassName(doc.name.substr(0,doc.name.length-4)));
className = className.split('.')[0];//just in case the user adds .as
className = toClassName(className);//remove non alphabet chars
var docPath = doc.pathURI.substr(0,doc.pathURI.length - doc.name.length);
var exportPath = docPath+className+'_export'+d;
if(!FLfile.exists(exportPath)) FLfile.createFolder(exportPath);
fl.outputPanel.clear();
for(i = 0 ; i < numFrames; i++) {
if(cl.frames[i].name != ''){//if frame is labelled
tl.setSelectedFrames(i,i,true);
doc.exportPNG(exportPath+cl.frames[i].name+lpad(''+i,4)+'.png',true,true);
}
}
fl.trace("export complete!");
function lpad(number, length){
var result = '' + number;
while (result.length < length) result = '0' + result;
return result;
}
function toClassName(input){
return input.replace(/[^a-zA-Z]/g, "");
}
Also, I suggest having a look at generator tools like Dynamic-Texture-Atlas-Generator, Fruitfly, etc.