Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Flash5 communicating with program

Posted on 2001-06-30
14
273 Views
Last Modified: 2008-02-01
I have Flash 5, and I have built some software in Borland's Delphi.  I am using the ActiveX component to run my .swf file.

I want to be able to read a person's name from the database and give it to the .swf file and have it just repeat an effect on it, like it glowing in and out.

I can get the data fine.  I have not done anything with Flash and would appreciate a tutorial on how to do this.  I have read through the basic tutorials and help, so I am somewhat familiar with Flash.

In Delphi I have an event called "OnFSCommand".  If I go into Flash it has an Action called FSCommand.  I am guessing that I can use this somehow to pass it the name and use it.

Maybe it would be simpler if someone just made a simple flash file so that I can see how it was done, rather than trying to explain everything.  Just tell me what parameter I need to send and I can do that part of it.
0
Comment
Question by:perkley
  • 5
  • 5
  • 3
  • +1
14 Comments
 
LVL 3

Expert Comment

by:jeffbeasley
ID: 6241797
If you can wait till Monday I can create you a sample file; or I can give you some minor assistance here
You would start by importing the variable from Flash and wrighting to a text field you do this by
creating an asp file or cf file or even txt file  that gives you the var being drawn from the database as follows
some_var=some name
where as some_var is your variable name and "some name" is your string being passed

you would then type this action script in your
loadVariables("document.asp",some_var);
this should load your var you can test to see if loaded typing
trace(some_var);
this will show up in an output window when you execute a publishing of flash within flash by pressing  
<ctrl> and <enter>

you would then create  a text field with you text tool
and go to the panel were you adjust text from static text to dynamic text or input text
choose dynamic text
this will give you the option of giving the text a variable name (in the panel)
you would name it some_var
the string "some name" will show up as text in your text field when published

you can then mess with creating glowing animations by creating various colors and layers of text

This is fairly simple when you are able to import your var
the problem with using fscommands is that it has problems executing on the Mac  

the key to getting your var to load is to create a program that will execute a page that loads your var into a web page thats code and output is equal to some_var=some name when viewed outside the programs environment

Hope this makes since I don't have my flash manuals or flash in front of me to be more precise
I can expand later if you need more assistance;
however this should point you in the right direction
(if it makes since ;)
Good Luck
Jeff
0
 

Author Comment

by:perkley
ID: 6241921
I can wait till Monday, however the FSCommands will work for me as it is a program that is Windows based and is only used by us, it is not given out to others.  I can customize it to my machine.

The name will change quite often, so I need to be able to just give it the new name and it shows it with the effects.

Thanks for any help you can give.  How would I do it with the FSCommand?
0
 
LVL 5

Expert Comment

by:stef4s
ID: 6243859
the fscommand is used to communicate from flash to host. You get other methods for the control to send messages from the host to flash. What is your email I can send you some documentation on these methods.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 5

Expert Comment

by:stef4s
ID: 6243867
for example to set a variable in the flash movie you use the following (VB code) movie.setvariable(varname,value)
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 6244418
This is sooooooo simple.

I created a movie clip with a button on it.  I added the following actionscript to the "MouseUp" event of the button....

    onClipEvent (mouseUp) {
        fscommand ("MessageDlg", "This is a test message box, run from within Delphi.");
    }

Then, I put this code within the "OnFSCommand" event of the Delphi app....

      If Command='MessageDlg' then
        MessageDlg(Args, mtInformation, [mbOk], 0);

I ran the application, clicked the button and got the message box.  That's all there is to it.  You handle the different events yourself within the "OnFSCommand" event.

If you need more help, give me a shout.

John.
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 6244432
Oh yeah, have a look at this link too.  VERY useful for the Flash/Delphi programmer.

    http://www.delphipages.com/news/detaildocs.cfm?ID=38


John.
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 6244443
Oops...I actually added the actionscript to the "OnRelease" event of the button, not "OnMouseUp".  (There is no mouseUp for buttons!)

John.
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 6244929
Sorry to keep posting to the same question when there's not been any other comments, but I though you may like this link too....

        http://www.geocities.com/jaymol/

There's a component called "TFlashPlayer" which is just a wrapper for the ActiveX component.  The only difference to using this rather than importing the ActiveX directly is that this component will install & register the ActiveX on the target machine if it is not presently installed.

Enjoy,

John.
0
 
LVL 5

Expert Comment

by:stef4s
ID: 6245023
Jaymol, do you add any functionality to this OCX
0
 
LVL 5

Expert Comment

by:stef4s
ID: 6245036
Because I am busy with my own ax wrapper that will allow me to stream video with flash
0
 

Author Comment

by:perkley
ID: 6245265
Thank you for all the comments.  I have a question for Jaymol though.  You are using Flash to reproduce a Delphi dialog box.  What I want to do though is have Delphi give Flash some text (a person's name specifically).  How does Flash know when to start the repeated effect over with the new text.  I need to somehow tell my Flash File to go and run the OnFSCommand again and start at Frame 0 again.  This may be simple, but I have never done much with this stuff so any help would be appreciated.
0
 
LVL 5

Expert Comment

by:stef4s
ID: 6247475
you need the active x methods

here is an example for some of them



GetVariable
 4, 5   4, 5
  Syntax  GetVariable(varName)
 
       
  Description  Returns the value of the Flash variable specified by varName. Returns null if the variable does not exist. The argument type is string.
 
       
  Example  var firstName = movie.GetVariable("FirstName");

var radioButtonValue = movie.GetVariable("/Form/RadioButton:Value");




       
    GotoFrame 2,3,4, 5   2,3,4, 5
  Syntax  GotoFrame(frameNumber)
 
       
  Description  Activates the frame number specified by frameNumber in the current movie. If the data for a requested frame is not yet available, the player goes to the last frame available and stops, causing unexpected results during playback. Use the PercentLoaded() method to determine if enough of the movie is available to execute the GotoFrame() method.
The argument frameNumber is zero-based; that is, frameNumber is 0 in the first frame of the movie, 1 for the second frame, and so on. This differs from the Goto action within Flash, which begins at 1. The argument type is integer.
 

       
  Example  movie.GotoFrame(24);



       
    IsPlaying 2,3,4, 5   2
  Syntax  IsPlaying()
 
       
  Description  Returns true if the movie is currently playing.
 
       
  Example  if (movie.IsPlaying()) { alert("movie is playing"); }



       
    IsPlaying NA   3,4, 5
  Syntax  IsPlaying()
 
       
  Description  Returns true if the movie is currently playing.
 
       
  Example  if (movie.IsPlaying()) { alert("movie is playing"); }


I can email you the full documentation


 
0
 
LVL 6

Accepted Solution

by:
Jaymol earned 100 total points
ID: 6247712
Here's what I did....

Let's do layer1 first.
------------------------------------------
Frame 1, empty keyframe.
Frame 2, this actionscript...

if (MyName=="") {
    gotoAndPlay (1);
}

Frame 3, this actionscript...

TextField1 = MyName;
stop ();


Now let's do layer2.
------------------------------------------
Frames 1 & 2 are blank.
Frame 3 has a Dynamic Text Field (named TextField1).

That's the flash movie done.

In Delphi, I have a form with the Shockwave component on it.  This component has been set to Embed:=True and Movie:=That one above.

In the FormCreate event, I have this following line of code...

  ShockwaveFlash1.SetVariable('MyName', 'John');

Run it!

Delphi tells Flash the contents of "MyName", and Flash is saying "until you tell me, I ain't moving!".  It gets the name and continues to play, setting the TextField1 variable to the name specified by Delphi.  (In this case, John.)

Hope this clears things up a bit.  If there's anything else, just ask away.

Stef: I've just wrapped the OCX with the installation code.  That's all I've done.  Let's face it, the OCX itself is not pretty in Delphi, but there's ways and means around the nasty stuff it does/doesn't do.  Have a look at DelphiPages.com as there's a few articles in there about some of the problems and how to get round them.

Thanks,

John.
0
 

Author Comment

by:perkley
ID: 6260113
Thanks for your help.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
FLV versus SWF 11 283
Open Source MP4 Flash Player 2 189
free photo watermark software 5 93
What is needed to center a flash image to the center of the page? 4 103
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question