PDA

View Full Version : Flash Button Opens Mult. Instances of Prog.



spakk
11-05-2003, 12:20 AM
When I try to open a program on my desktop via an AMS flash object, it opens two instances of the prog. Not good.

To start, I created a simple flash btn with the action script code:

On (release){
fscommand("test")
}

Next, I put the Flash object on an AMS page and added the actions to get the property variable for the fscommand command. Next I used an IF statement to check the property 'On Fscommand.' If it matched the IF, I ran an Open.File on a path leading to the Access database file (in this case).

I've tried variations like placing a RETURN statement following the Open.File action, changing the property variable immediately following the Open.File command, placed a pause after the get.property command etc. - But it seems the fscommand is firing more than once at a single click of the button.

Two methods produced the desired result:
1) I placed a message box just after the get.property command line in the code. That seems to hang the execution long enough to keep the flash from sending the message twice...

2) If I move the mouse out away from the button 'hot spot' immediately after clicking it.

Any insight appreciated.

Corey
11-05-2003, 12:43 AM
Hi. I'd have to see your flash and AMS files to say for sure. If your Flash is firing an FScommand more than once then the problem is in the flash. AMS will not detect a single FSCommand as more than one, I have tested the daylights out of it and it works perfectly in this regard.

In terms of your AMS no need for the IF statement in this case. Just put a file open action in the OnFScommand event. One single action, no room for errors. Try that and let me know how it goes.

One more question, what happens when you double click your database file in Windows explorer?

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

spakk
11-05-2003, 02:28 AM
What I'm trying to achieve is an AMS menu that will sit on the desktop and open various progs on the PC. It consists of a single Flash object containing multiple buttons designed within Flash.

The buttons have a simple Flash Action Script code (as described earlier) placed on each button instance, on the root timeline, that produces an fscommand string like "a1" "a2" "a3" etc. Each has text in the Up button frame, and a colored background in the Over button frame. During AMS runtime, I notice that the colored background stays lit momentarily after mouse release - don't know if this is relevant. When I throw a Message box in between the get.Property and open.File statements, the pause caused by the text box lets the Flash button return to its Up state before the open.File command is sent - and only one instance of the prog opens (is there a correlation?) Same thing when I click on the button and quickly move the mouse away from the 'hot spot.'

To answer your question, when I put the open.File action alone with the OnFScommand event, it works. Only one instance opens. Once I start to add multiple IF statements to account for the various buttons - trouble.
Also, opening the .mdb / .mde files directly, through desktop '.lnk' shortcuts etc. in Explorer, Commander or whathaveyou always only opens one instance.

Here's the AMS code:


<IR_ACTIONS_LIST>
<Action name="Get Property">
<Type>98</Type>
<Function>0</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Variable>%Property%</Variable>
<ObjectName>Flash1</ObjectName>
<Property>Last FSCommand</Property>
</Action>
<Action name="IF">
<Type>200</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Condition>%Property% = "quit"</Condition>
</Action>
<Action name="Exit">
<Type>2</Type>
<Function>0</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
</Action>
<Action name="END IF">
<Type>201</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
</Action>
<Action name="IF">
<Type>200</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Condition>%Property% = "a4"</Condition>
</Action>
<Action name="Open">
<Type>7</Type>
<Function>0</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<FileName>V:\testFile\FileA.mdb</FileName>
<Verb>open</Verb>
<WorkingDir/>
<RunMode>0</RunMode>
</Action>
<Action name="END IF">
<Type>201</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
</Action>
<Action name="IF">
<Type>200</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Condition>%Property% = "a5"</Condition>
</Action>
<Action name="Open">
<Type>7</Type>
<Function>0</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<FileName>V:\testFile\FileB.mdb</FileName>
<Verb>open</Verb>
<WorkingDir/>
<RunMode>0</RunMode>
</Action>
<Action name="END IF">
<Type>201</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
</Action>
<Action name="IF">
<Type>200</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Condition>%Property% = "a6"</Condition>
</Action>
<Action name="Open">
<Type>7</Type>
<Function>0</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<FileName>V:\testFile\FileC.mdb</FileName>
<Verb>open</Verb>
<WorkingDir/>
<RunMode>0</RunMode>
</Action>
<Action name="END IF">
<Type>201</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
</Action>
</IR_ACTIONS_LIST>

(by the way, thanks for the quick reply)

Corey
11-05-2003, 02:48 AM
OK well we have isolated the problem then at least, your IF syntax. Should be easy to fix. If you want me to check out your code just upload your project here using the file attachment feature. Other than that the only thing I can offer is this:

http://www.autoplaystudio.com/webhelp/Command_Reference/Actions/Control_Structure/ControlStructure.IF.htm

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

spakk
11-05-2003, 03:39 AM
I'll simplify it:


%Property%=FlashObject[Flash1].GetProperty ("Last FSCommand")
IF (%Property%="quit")
Application.Exit
END IF
IF (%Property%="a1")
File.Open (open, "V:\TestFile\FileA.mdb")
END IF
IF (%Property%="a2")
File.Open (open, "V:\TestFile\FileB.mdb")
END IF
IF (%Property%="a3")
File.Open (open, "V:\TestFile\FileC.mdb")
END IF

Seems pretty straightforward. Am I missing something obvious?

Corey
11-05-2003, 03:47 AM
As I mentioned I can only check your code if you upload a file.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

spakk
11-05-2003, 05:32 PM
Umm... okay.

Exactly what part(s) of it would you like?
Everything in the distribution folder?
The .am4 file & resources folder?

Zipped?

Corey
11-05-2003, 05:41 PM
Whatever you prefer. Limit is 750K. If I can't see your code in play I can't really say what's going wrong...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

spakk
11-05-2003, 06:38 PM
Alright, here's the .am4 file.

(The only code is just what I typed earlier - verbatim).

By the way, .am4 files aren't allowed, only .am5 (??).
I've zipped it.

spakk
11-07-2003, 02:05 PM
...and this problem seemed so elementary.

Having any luck?

Corey
11-08-2003, 12:49 AM
Not sure. IF syntax looks OK at a glance. I have no experience with .mdb files so I can't say what's going on for sure... Sorry.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

spakk
11-08-2003, 02:25 PM
Don't sweat it. In your earlier quote you'd seemed confident that the IF syntax was the culprit, so I was crossing my fingers.

I've created, VB-coded, and maintain seven Access databases at work (not my primary job!) for automated report generation, personnel tracking, training etc. I've also written a fair amount of action script for Flash(5), used as both stand-alone projectors and incorporated into Access. So you can understand the vested interest in finding programs compatible with Access & Flash.

I tried AMS over two years ago and was favorably impressed, but was more focused on the above progs at that time. Now that I've developed the content, I'm looking to author training CDs for new employees - AMS came to mind. Ideally, I'd prefer to show my bosses a functioning demo of AMS when I hand them the software requisition paperwork. I've got about 18 days left on the trial versions (home/work).

The problem I've detailed occurs on both W2K OS machines. In further testing today, I found the mult. instances issue - while intermittent - happens on both Access .mdb/.mde files *and* .exe files. I recreated a *simple* Flash button on a trial version of MX, and exported as both vers. 5 and vers. 6 - same problem.

I've included a .jpg of the button from Flash.
Has no one else experienced this?

Corey
11-08-2003, 03:18 PM
If I create a flash button here with an fscommand which I use to trigger a File.Open action on an .exe file I get only one instance of the file opening. This is consistent with the experience all our users have. If you are getting different results then it's an issue on your end...

If you post your files I can take a look. But obviously you need to post all files related to your question, this would include your flash .fla, flash .swf, and intact AMS project otherwise it would be impossible for me to assess the situation. Posting screencaps of code doesn't allow me to actually see or test any of the code...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

spakk
11-08-2003, 06:54 PM
Understood. When you said, 'whatever you like' earlier, I wondered if the code alone would suffice.

Due to the upload limit, I'll send the autorun.exe separately...

spakk
11-08-2003, 06:55 PM
...and the exe...

Thanks.

spakk
11-08-2003, 06:57 PM
By the way, I intentionally stripped the .swf file from the Flash folder to save space. I assume the distro folder .dav file will be adequate.

Corey
11-08-2003, 07:04 PM
Hi. No flash? Also, built files are of no use, only raw source files. Anyhow when posting stuff you must leave you project intact or I can'r see what's going on, i.e. if you choose to omit the .swf file then it's impossible for anyone to test the project.

Here's a couple guidelines.

1. No built files or projects.
2. Always include all supporting files, i.e. send your project unmodified from the state in which you are experiencing the problem.
3. If you are posting a project which contains Flash, please post your .fla source file too.

As I said above, once I get your project complete with .fla and .swf I can try to see what's going wrong.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

spakk
11-08-2003, 09:36 PM
Please unzip the file, 'test.zip.' In the root directory you'll find the .fla file you seek.

Now go to the file 'Test>Distribution>Data. In it you'll find, 'Menu1.dav' This is the .swf file renamed by AMS. Just copy it and rename the copy back to 'swf' (then restore it to the Resources>Flash directory if necessary).

I believe you already have the files you require.

(If not, please humor me and specify exactly what file extensions/folders you require. If I didn't suspect better, I'd start to think you're working on me :) )

Corey
11-08-2003, 10:33 PM
OK let's work this from a different angle, it's becoming more time consuming than need be. So I have created for you an example download this file http://www.indigorose.com/temp_web/example.zip and you will find a working project along with .fla file for the buttons.

As you can see it works fine, feel free to use the project as a template to repair yours, best of luck...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

spakk
11-09-2003, 01:40 AM
"As you can see it works fine,..."

Wish I could see with your eyes :cool:

In fact, the symptoms I described - though intermittent with no clear pattern - remain. The first time a btn was clicked, no problem. The second time clicked (different btn) resulted in a window opening properly, then an error msg window stating an amsdata.dat file was missing. When that window was acknowledged, a second instance of the initially opened window appeared. At another point interspersed with successful clicks, an errMsg, 'extract error 28' popped up.

Also, your code was functionally identical to what I'd posted earlier in this thread. My IF statement fscommand strings ("a1" etc.) were enclosed in quotation marks - yours were not. Tried it your way, no dice.

This type of intermittent thing is the bane of any tech. You can't fix a problem if you can't duplicate it. What puzzles me is the ability to duplicate this behavior on another PC (one I've set up, the other by the IT dept.)

Finally, from a general reading of various threads on the board, I am left with the impression that:

1) You're everywhere at once
2) They have you wearing a lot of different hats
3) Coffee is your one of your best friends
4) You suffer fools graciously ;)
5) You're modest beyond what reality can support

Good luck back at you.

Corey
11-09-2003, 01:42 AM
:) Keeps me busy... It's nice at least working for someone who knows who "The Monks" are. That makes it all worthwhile.

Well at least we have an error screencap for Brett and the guys to take a look at on Monday, that might lead to something more concrete hopefully. I'm stumped.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

rhosk
11-09-2003, 06:11 AM
I did happen to duplicate the problem and I was very interested in the solution as well. I sort of have a "workaround" for you.

First off, lose the "pushed" parameter in your fscommand - not needed.

Second, make your application "wait" (File>>exec, instead of open) ((And just a reminder [in case you don't know], when you update your swf, re-attach in the object each time. I had a couple brainfarts myself there))
Third, and you're not going to believe this - save & exit the Autoplay application; hence don't just "preview" your project.

Something is going on in the temp folder for the user that I cannot explain (causing the intermittent dat & extraction errors, and duplicates of the executables - don't think Flash is doing this). Maybe the devs at IR can enlighten.

When I "built" your project (with the other recommendations) and used Corey's executables as test, totally exited the application, and ran your autorun.exe all by itself, they all fired nicely one at a time; no errors at all :)

Could be that Corey's execuatbles were built using APMS as well and they're trying to use the same temp file of sorts that the application is using, don't really know - and it doesn't really explain your original problem. But hey, follow these suggestions, and you at least can get it working and move on. Hope this helped.

spakk
11-09-2003, 02:45 PM
Thanks for the confirmation. Drinking and hallucinating are two things I prefer not to do alone :D

The "pushed" args cmd (fscommand) was originally in place for testing the AMS, 'LastFSCommandsArgs' parameter. It 'propagated' thru cutting/pasting in Flash. Think of it as an appendix.

"Wait" in the File.Execute command has roughly the same effect as using a msg box just after the Get.Property cmd - it hangs code execution long enough keep the Flash button from seemingly firing twice (see method #1 at the end of my initial msg in this thread). Both methods are impractical for two reasons.
1) What if I want more than one app opened at the same time?
2) Doesn't work for non-exe files.

The workaround of course would be to use File.Execute pointing to the .exe and adding a cmd line option pointing (in my case) to an Access mdb file. Well, I just tried that, add it worked eight out of ten attempts. Twenty percent failure rate still a little too high.

I have tried variations like you suggest in building/closing AMS etc. to no avail. Oddly, I only get the amsdata.dat file and Extract Error 28 messages with Corey's files. Being smaller, those files open considerably faster than mine, which could explain it.

In any event, thanks for the feedback!
------------------------
One aside for you, Corey. I noticed the help file for File.Execute reads (in part):
File to execute:
The full path to the file to execute (e.g. %SrcDrv%\My Docs\My Doc.txt).
I believe only .exe files will work with the File.Execute command.

Being an 'older' (4.0.0.4) vers of AMS I expect that this has been covered already in here somewhere, but this beta testing stuff is addictive ;)

spakk
11-16-2003, 09:35 PM
Originally posted by Corey
Well at least we have an error screencap for Brett and the guys to take a look at on Monday, that might lead to something more concrete hopefully. I'm stumped. [/B]

The expiry date is fast approaching. Any luck in the back room?

Corey
11-16-2003, 09:52 PM
I haven't heard anything new. I can only assume if one of the guys had any insights they would have posted them.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

spakk
11-17-2003, 05:27 PM
Very well. Presumably, I can download AMS v. 5 trial & put that version through the same paces. It may not be an issue there.

Corey
11-17-2003, 05:30 PM
Hopefully.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

spakk
11-18-2003, 05:59 PM
Works perfectly. There's no noticeable lag as seen with v4, or multiple instances opening.

I like the coding too. Looks like it's more in line with Flash Action Script (which is based on the European ECMA-262 Standard according to Macromedia).

Another improvement, v5 shuts down much more quickly than v4. Still can't get the prog to open maximized though. It’s always very slightly smaller than a full window until the title bar is double clicked. No big thing. Also noticed that the v5 help file, under FSCommand has an 'If...Then' statement example that's missing the 'then.'

Anyway, I'll be moving to the v5 forum. Thanks for your help here.

:)

Corey
11-18-2003, 06:06 PM
Yes actionscript is based is based on the European ECMA-262 Standard which is itself based directly upon the Javascript DOM, easy to use. Our is based upon the LUA programming language (http://www.lua.org/about.html), also easy to use and very powerful. Glad to hear you like it. :)

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)