@@ -37,12 +37,13 @@ import flash.display.*;
37
37
import flash.events.* ;
38
38
import flash.filters.GlowFilter ;
39
39
import flash.geom.* ;
40
- import flash.net.URLLoader ;
41
- import flash.text.* ;
40
+ import flash.net.URLLoader ;
41
+ import flash.text.* ;
42
42
import assets.Resources ;
43
43
import translation.Translator ;
44
44
import util.* ;
45
45
import uiwidgets.* ;
46
+ import scratch.ScratchStage ;
46
47
47
48
public class Block extends Sprite {
48
49
@@ -453,13 +454,21 @@ public class Block extends Sprite {
453
454
454
455
public function duplicate (forClone :Boolean , forStage :Boolean = false ):Block {
455
456
var newSpec: String = spec;
456
- if (forStage && op == 'whenClicked' ) newSpec = 'when Stage clicked' ;
457
+ if (forStage && op == 'whenClicked' ) newSpec = 'when Stage clicked' ;
457
458
var dup: Block = new Block(newSpec, type , (int )(forClone ? - 1 : base . color ), op);
458
459
dup. isRequester = isRequester;
459
460
dup. parameterNames = parameterNames;
460
461
dup. defaultArgValues = defaultArgValues;
461
462
dup. warpProcFlag = warpProcFlag;
462
- if (forClone) dup. copyArgsForClone(args ); else dup. copyArgs(args );
463
+ if (forClone) {
464
+ dup. copyArgsForClone(args );
465
+ } else {
466
+ dup. copyArgs(args );
467
+ if (op == 'stopScripts' && args [ 0 ] is BlockArg) {
468
+ if (forStage && args [ 0 ] . argValue == 'other scripts in sprite' ) dup. args [ 0 ] . setArgValue('other scripts in stage' );
469
+ if (! forStage && args [ 0 ] . argValue == 'other scripts in stage' ) dup. args [ 0 ] . setArgValue('other scripts in sprite' );
470
+ }
471
+ }
463
472
if (nextBlock != null ) dup. addChild (dup. nextBlock = nextBlock. duplicate(forClone, forStage));
464
473
if (subStack1 != null ) dup. addChild (dup. subStack1 = subStack1. duplicate(forClone, forStage));
465
474
if (subStack2 != null ) dup. addChild (dup. subStack2 = subStack2. duplicate(forClone, forStage));
@@ -749,7 +758,7 @@ public class Block extends Sprite {
749
758
/* Dragging */
750
759
751
760
public function objToGrab (evt :MouseEvent ):Block {
752
- if (isEmbeddedParameter() || isInPalette()) return duplicate(false );
761
+ if (isEmbeddedParameter() || isInPalette()) return duplicate(false , Scratch . app . viewedObj() is ScratchStage );
753
762
return this ;
754
763
}
755
764
0 commit comments