mirror of
https://github.com/scratchfoundation/scratch-flash.git
synced 2024-12-12 17:11:17 -05:00
Merge pull request #169 from nathan/broadcasts-in-palette
Fixed broadcasts created in palette not being accessible via menu
This commit is contained in:
commit
7a3c45fa2e
1 changed files with 19 additions and 12 deletions
|
@ -23,8 +23,8 @@
|
||||||
package scratch {
|
package scratch {
|
||||||
import flash.display.*;
|
import flash.display.*;
|
||||||
import flash.events.*;
|
import flash.events.*;
|
||||||
import flash.external.ExternalInterface;
|
import flash.external.ExternalInterface;
|
||||||
import flash.geom.Rectangle;
|
import flash.geom.Rectangle;
|
||||||
import flash.media.*;
|
import flash.media.*;
|
||||||
import flash.net.*;
|
import flash.net.*;
|
||||||
import flash.system.System;
|
import flash.system.System;
|
||||||
|
@ -36,6 +36,7 @@ import flash.geom.Rectangle;
|
||||||
import primitives.VideoMotionPrims;
|
import primitives.VideoMotionPrims;
|
||||||
import sound.ScratchSoundPlayer;
|
import sound.ScratchSoundPlayer;
|
||||||
import ui.media.MediaInfo;
|
import ui.media.MediaInfo;
|
||||||
|
import ui.BlockPalette;
|
||||||
import uiwidgets.DialogBox;
|
import uiwidgets.DialogBox;
|
||||||
import util.*;
|
import util.*;
|
||||||
import watchers.*;
|
import watchers.*;
|
||||||
|
@ -202,9 +203,7 @@ public class ScratchRuntime {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectBroadcasts():Array {
|
public function collectBroadcasts():Array {
|
||||||
var result:Array = [];
|
function addBlock(b:Block):void {
|
||||||
allStacksAndOwnersDo(function (stack:Block, target:ScratchObj):void {
|
|
||||||
stack.allBlocksDo(function (b:Block):void {
|
|
||||||
if ((b.op == 'broadcast:') ||
|
if ((b.op == 'broadcast:') ||
|
||||||
(b.op == 'doBroadcastAndWait') ||
|
(b.op == 'doBroadcastAndWait') ||
|
||||||
(b.op == 'whenIReceive')) {
|
(b.op == 'whenIReceive')) {
|
||||||
|
@ -213,8 +212,16 @@ public class ScratchRuntime {
|
||||||
if (result.indexOf(msg) < 0) result.push(msg);
|
if (result.indexOf(msg) < 0) result.push(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
var result:Array = [];
|
||||||
|
allStacksAndOwnersDo(function (stack:Block, target:ScratchObj):void {
|
||||||
|
stack.allBlocksDo(addBlock);
|
||||||
});
|
});
|
||||||
});
|
var palette:BlockPalette = app.palette;
|
||||||
|
for (var i:int = 0; i < palette.numChildren; i++) {
|
||||||
|
var b:Block = palette.getChildAt(i) as Block;
|
||||||
|
if (b) addBlock(b);
|
||||||
|
}
|
||||||
result.sort();
|
result.sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue