Prevented duplicate sprite names

This commit is contained in:
Nathan Dinsmore 2014-06-16 13:43:18 -04:00
parent 716c064379
commit bf9ce4a865
2 changed files with 3 additions and 0 deletions

View file

@ -663,6 +663,8 @@ public class ScratchRuntime {
public function renameSprite(newName:String):void {
var obj:ScratchObj = app.viewedObj();
obj.objName = '';
newName = app.stagePane.unusedSpriteName(newName);
var oldName:String = obj.objName;
obj.objName = newName;
for each (var lw:ListWatcher in app.viewedObj().lists) {

View file

@ -341,6 +341,7 @@ public class SpriteInfoPart extends UIPart implements DragClient {
private function nameChanged():void {
app.runtime.renameSprite(spriteName.contents());
spriteName.setContents(app.viewedObj().objName);
}
public function updateThumbnail():void {