Issue solved..
I notice that if I make the local connection from flex to flash (not
the other way around as I tried before), it will throw an error if it
is already connectd.
So, to summarize:
If you want to prevent the user from running multiple instances .. you
create a new local connection and make it connect as follows:
private function initil():void
{
try{
dReceiveLC = new LocalConnection();
dReceiveLC.client = this;
dReceiveLC.connect("dummyFlash2Flex");
} catch(err:ArgumentError)
{
Alert.show(err.message,err.errorID.toString());
}
}
It will catch an error if it is already connected.
Alex, thank you for helping me through this problem. Your help is
highly appreciated.
Regards, Malik
On Nov 1, 2007 8:27 PM, Malik Al-Arfaj <[EMAIL PROTECTED]> wrote:
> No, it doesn't throw any kind of error! What happens is that the flash
> will run by it's default values and will not be affected by the values
> that 'should' have been passed to it. Well, thanks to that, I thought
> of creating a dummy flash that runs at the beginning of the flex
> application. And it will wait for flex to contact it. After being
> contacted by flex it will send a variable to the parent flex
> application through another local connection to tell flex that
> everything is fine and it is OK to proceed. I will try that and report
> the results later tonight.
>
> Regards,
> Malik
>
>
> On Nov 1, 2007 1:32 PM, Alex Harui <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > If you aren't getting a failure on connect, do you get one on send?
> >
> >
> >
> > ________________________________
> >
> >
> > From: [email protected] [mailto:[EMAIL PROTECTED] On
> > Behalf Of Malik Al-Arfaj
> > Sent: Thursday, November 01, 2007 11:25 AM
> >
> >
> > To: [email protected]
> > Subject: Re: [flexcoders] Prevent users from running multiple instances at
> > the same time.
> >
> >
> >
> >
> >
> >
> >
> >
> > No, everything works fine except that the flex won't interact with the
> > flash movie in the second instance.
> >
> > On Nov 1, 2007 11:12 AM, Alex Harui <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > If you take out the catch and alert, do you get the error thrown?
> > >
> > >
> > >
> > > ________________________________
> > >
> > >
> > > From: [email protected] [mailto:[EMAIL PROTECTED] On
> > > Behalf Of Malik Al-Arfaj
> > > Sent: Wednesday, October 31, 2007 6:06 PM
> > > To: [email protected]
> > > Subject: Re: [flexcoders] Prevent users from running multiple instances
> > at
> > > the same time.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Alex, thanks for replying. May you please explain how can I do that?
> > >
> > > I tried:
> > >
> > > try
> > > {
> > > var myLC:LocalConnection;
> > > myLC = new LocalConnection();
> > > myLC.connect("TestLC");
> > > }
> > > catch (err:ArgumentError)
> > > {
> > > Alert.show("Redirect to another page","Failure");
> > > }
> > >
> > > but it doesn't seem to work..
> > >
> > > Regards,
> > > Malik
> > >
> > >
> > > On 10/31/07, Alex Harui <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >
> > >
> > >
> > >
> > > If the lc fails you can navigatetourl to a different page
> > >
> > >
> > >
> > > ________________________________
> > >
> > >
> > > From: [email protected] [mailto: [EMAIL PROTECTED] On
> > > Behalf Of m.arfaj
> > > Sent: Wednesday, October 31, 2007 1:24 PM
> > > To: [email protected]
> > > Subject: [flexcoders] Prevent users from running multiple instances at
> > the
> > > same time.
> > >
> > >
> > >
> > >
> > >
> > >
> > > Hi,
> > >
> > > I embedded a flash 8 movie w/ AS2 in my flex application and used
> > > a local connection to exchange data. Everything works fine except that
> > > if
> > > I open the page twice, the Local connection in the second instance
> > > won't work -which screws the whole purpose of it-. The question is can
> > > I prevent the user from opening multiple instances from the same flash
> > > at the same time?! or at least if it is not possible in Flex, is there
> > > another way to do it with JavaScript or PHP?!
> > >
> > > Regards,
> > > Malik
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
>