Adobe Connect User Community
Menu

#1 2009-06-15 10:49:55

**_sjmccoy_**

AS2 SWF not fully functional when published

I've designed a flash AS2-based drag-and-drop mini game. The SWF works fine in PowerPoint and when viewed using Flash Player. However, when I embed the SWF using Presenter 7.02 and publish the presentation, only certain parts of the mini game work. Specifically, the drag works, and my dynamic textbox will display feedback text, but the drop targets don't function. I can't place the drag object on the drop targets. I think some of my AS2 needs to be changed so that its not rendered useless when published by Presenter.

Any recommendations on how to fix my AS2 will be appreciated. You can download the FLA file here: http://www.designwrite.info/files/hazmat_as2.fla.

Offline

#2 2009-06-15 12:19:54

**_mark2741_**

Re: AS2 SWF not fully functional when published

I'd take a look but your fla link is dead. One question - are you using any components? I haven't tried any flash swf's that use components in Presenter (I try to avoid Presenter for anything other than straight voice-over presentations and just use Captivate for everything else). I know that swf's with components didn't work with Captivate 3 (haven't tried with CP4).

mark
www.elearninglive.com

Offline

#3 2009-06-15 13:16:52

**_sjmccoy_**

Re: AS2 SWF not fully functional when published

The link isn't dead, the forum just include a period '.' at the end of my setence as part of the URL. Anyway, here's the link again, sans period:

http://www.designwrite.info/files/hazmat_as2.fla


And no, I'm not using any components.

Offline

#4 2009-06-15 16:07:42

**_sjmccoy_**

Re: AS2 SWF not fully functional when published

I think Presenter wouldn't accept nested AS2 (I assigned code to individual movie clips). So I re-wrote the AS to work in one "actions" layer. It appears to be working now.

This is the code I found, courtesy of Render Robot (http://www.renderrobot.com/blog/flash-d … p-with-as2), that allows me to create a drag-and-drop game without nested AS:

// Drag and Drop
// Alex Fish

//====== Varibles ========

var fixedX:Number = box._x;
var fixedY:Number = box._y;

//======== end Varibles ========

//======== drag and drop functionality =========

box.onPress = function() {
    startDrag(this);
};

box.onRelease = function() {
    if(box.hitTest(mc_snapArea)){
        box._x = mc_snapArea._x;
        box._y = mc_snapArea._y;
        hitTestText.text = "Collision Detected";
    } else {
        box._x = fixedX;
        box._y = fixedY;
        hitTestText.text = "No Collision Detected";
    }
    stopDrag();
};

//========= end drag and drop  ========

Offline

#5 2009-06-15 20:06:54

**_AChemey_**

Re: AS2 SWF not fully functional when published

sjmccoy,

Actually, it's because of the use of _root.  If you took your same file and attempted to load it in a MovieClip in another Flash file

For example:
- New Flash file
- Insert the following AS:

this.createEmptyMovieClip("loader_mc", this.getNextHighestDepth());
loader_mc.loadMovie("hazmat_as2.swf");


The same problems would occur.

When your file is the root of the Flash container, then references to _root are acceptable, but still not recommended.

I modified your code (and stripped some redundancy) out using your same mechanism, but using _parent - when appropriate (instead of _root) and the animation with the drag/drop operates, as expected: http://www.learningconsulting.com/conte … s2_AEC.zip

Again, it's not recommended to use _root or _global, in general.  Attempt to roll-up to find the object or container you need.

Regards,

Andrew

Offline

#6 2009-06-15 20:24:12

**_sjmccoy_**

Re: AS2 SWF not fully functional when published

Thanks for your comment/assistance Andrew! Very good to know.

Offline

Board footer