mirror of
https://github.com/scratchfoundation/scratch-flash.git
synced 2024-12-04 21:21:06 -05:00
Made attribute block update when switching sprite
If the sprite you switch to doesn’t have an attribute or variable, it will set the attribute to the default one for sprites or the stage.
This commit is contained in:
parent
18172ebf1b
commit
e13120da3f
1 changed files with 7 additions and 0 deletions
|
@ -402,6 +402,13 @@ public class BlockMenus implements DragClient {
|
|||
else if (s == 'myself') blockArg.setArgValue('_myself_', Translator.map('myself'));
|
||||
else if (s == 'Stage') blockArg.setArgValue('_stage_', Translator.map('Stage'));
|
||||
else blockArg.setArgValue(s);
|
||||
if (block.op == 'getAttribute:of:') {
|
||||
var obj:ScratchObj = app.stagePane.objNamed(s);
|
||||
var attr:String = block.args[0].argValue;
|
||||
var allowedAttrs:Array = obj.isStage ? ['backdrop #', 'background #', 'backdrop name', 'volume'] :
|
||||
['x position', 'y position', 'direction', 'costume #', 'costume name', 'size', 'volume'];
|
||||
if ((allowedAttrs.indexOf(attr) == -1) && (obj.varNames().indexOf(attr) == -1)) block.args[0].setArgValue(obj.isStage ? 'backdrop #' : 'x position');
|
||||
}
|
||||
Scratch.app.setSaveNeeded();
|
||||
}
|
||||
var spriteNames:Array = [];
|
||||
|
|
Loading…
Reference in a new issue