mirror of
https://github.com/scratchfoundation/scratch-flash.git
synced 2024-12-04 21:21:06 -05:00
Merge pull request #248 from djdolphin/validate-attributes
Make attribute block update when switching sprites
This commit is contained in:
commit
20d24f2a63
1 changed files with 7 additions and 0 deletions
|
@ -413,6 +413,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 validAttrs:Array = obj.isStage ? ['backdrop #', 'background #', 'backdrop name', 'volume'] :
|
||||
['x position', 'y position', 'direction', 'costume #', 'costume name', 'size', 'volume'];
|
||||
if ((validAttrs.indexOf(attr) == -1) && !obj.ownsVar(attr)) block.args[0].setArgValue(obj.isStage ? 'backdrop #' : 'x position');
|
||||
}
|
||||
Scratch.app.setSaveNeeded();
|
||||
}
|
||||
var spriteNames:Array = [];
|
||||
|
|
Loading…
Reference in a new issue