Variables between two swfs

I have a main.swf (level0)and a news.swf (level1). News.swf
is loaded because main.swf tells it so :-). If I have a variable in
news.swf, does it become part of the main.swf? I want to send a
variable from news.swf to main.swf, so the main.swf knows which swf
must load after event in news.swf. Which is the best way to do
that? Is it a LocalConncetion?
THX for advice

rohai wrote:
> I have a main.swf (level0)and a news.swf (level1).
News.swf is loaded because
> main.swf tells it so :-). If I have a variable in
news.swf, does it become part
> of the main.swf?
Not it does not becomes part of the main.swf but there is no
problem to access
the variables across multiple levels tho. _level1.vars=value;
or _level0.vars=value;
Best Regards
Urami
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami>

Similar Messages

  • How can I pass a variable(s) between two swfs?

    Hello all,
    I was wondering if it is possible to pass variables between
    two standalone swfs that are not being hosted on a webserver.
    I am creating a flash projector to go on a CD Rom and want to
    load another swf into the _root level and in the process, want to
    pass a variable or two to the "new" swf that is being loaded. Any
    help or insights that you can offer would be greatly appreciated!
    Thanks for your help.
    Tim

    if by _root level you mean you're loading something into
    _level0 you can't won't be able to use the localconnection. the
    sharedobject is your only option.

  • Sharing a shared network variable between two PC's connected to a network

    Sharing a shared network variable between two PC's connected to a network
    Surely this shouldn’t be so difficult! I have a little LabVIEW program running in the background of PC1. The exe’s task is to collect and send OPC variables held on a SCADA system and convert them to shared network variables (as I thought that they would be easy to share over a network, easier than the nasty OPC and DCOM issues). I have PC2 which runs measurement studio and I have created a nice test VB program which either writes or reads the network variables which are on PC1. The PC1 collection software is working perfectly and when I change the values on the SCADA system I can see the network variable change on ‘NI Distributed System Manager’. I When I look at ‘NI Distributed System Manager’ on PC2 I can’t see PC1 on the list and when I use the basic measurement studio code below to read the network variable it times out at the TestVariable.connect() line.
    Ok so what do I need to do to read a shared network variable sat on PC1 from PC2 on the network
    Public Class Form1
    Private WithEvents TestVariable As NetworkVariableSubscriber(Of Double)
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    TestVariable = New NetworkVariableSubscriber(Of Double)("\\192.168.58.139\Test\TestVariable")
    TestVariable.Connect()
    End Sub
    Private Sub TestVariable_Data_Updated(ByVal sender As System.Object, ByVal e As NationalInstruments.NetworkVariable.DataUpdatedEve​ntArgs(Of Double)) Handles TestVariable.DataUpdated
    TextBox1.Text = e.Data.GetValue
    End Sub
    End Class

    Sorry lost all the formatting
    Surely this shouldn’t be so difficult! I have a little
    LabVIEW program running in the background of PC1. The exe’s task is to collect
    and send OPC variables held on a SCADA system and convert them to shared
    network variables (as I thought that they would be easy to share over a
    network, easier than the nasty OPC and DCOM issues). I have PC2 which runs
    measurement studio and I have created a nice test VB program which either
    writes or reads the network variables which are on PC1. The PC1 collection
    software is working perfectly and when I change the values on the SCADA system
    I can see the network variable change on ‘NI Distributed System Manager’. I
    When I look at ‘NI Distributed System Manager’ on PC2 I can’t see PC1 on the
    list and when I use the basic measurement studio code below to read the network
    variable it times out at the TestVariable.connect() line.
    Ok so what do I need to do to read a shared network variable
    sat on PC1 from PC2 on the network
    Public Class Form1
        Private
    WithEvents TestVariable As NetworkVariableSubscriber(Of Double)
    Private Sub Form1_Load(ByVal sender As System.Object,
    ByVal e As System.EventArgs) Handles MyBase.Load
    TestVariable = New NetworkVariableSubscriber(Of
    Double)("\\192.168.58.139\Test\TestVariable")
    TestVariable.Connect()
    End Sub
    Private Sub TestVariable_Data_Updated(ByVal sender As
    System.Object, ByVal e As
    NationalInstruments.NetworkVariable.DataUpdatedEve​ntArgs(Of Double)) Handles
    TestVariable.DataUpdated
    TextBox1.Text = e.Data.GetValue
    End Sub
    End Class 

  • How can I share Pin variable between two packages?

    Hi every one,
    Is there any one who knows how can I share Pin variable that it is defined with OwnerPin between two packages in java card( with eclipse 3.1),I studied Sharing Interface subject and I knows it teorical but I can not do it practical .
    I can share primitive data type but I can not share Ownerpin.
    If anybody has some sample codes or knows any link ,please inform me.
    My code is same as below:
    //In Server Side
    package ginaPack;
    import javacard.framework.*;
    public class GinaApplet extends Applet implements GinaInterface{
    OwnerPIN pin;
    private GinaApplet (byte[] bArray,short bOffset,byte bLength) {
        pin =new OwnerPIN(PIN_TRY_LIMIT,MAX_PIN_SIZE);
              byte PinTemp[] = new byte[4];
              PinTemp[0] = (byte) 0x31;
              PinTemp[1] = (byte) 0x31;
              PinTemp[2] = (byte) 0x31;
              PinTemp[3] = (byte) 0x31;
              pin.update(PinTemp, (short) (0), (byte) PinTemp.length);       
        public Shareable getShareableInterfaceObject(AID clientAID,byte parameter)
              return  this;
        public OwnerPIN getPinShareable()
             return pin;         
         public void process(APDU apdu)
                      //there are some codes in this here
    }//Interface in Server side
    public interface GinaInterface extends Shareable
          public OwnerPIN getPinShareable();
    }//In Client side
    import ginaPack.*;
    public class UserCardApplet extends Applet {
    private UserCardApplet(byte[] bArray, short bOffset, byte bLength) {
         //there are some codes in this here
    public boolean select() {
              final byte[] Gina_AID={(byte)0x47,(byte)0x69,(byte)0x6e,(byte)0x61,(byte)0x41,(byte)0x70,(byte)0x70,(byte)0x6c,(byte)0x65,(byte)0x74};
              AID GinaAID = JCSystem.lookupAID( Gina_AID, ( short )0,( byte )Gina_AID.length );
              if ( GinaAID == null ) // probably not loaded on card
                        ISOException.throwIt( ISO7816.SW_FUNC_NOT_SUPPORTED );//6a 80
              GinaInterface ff = (GinaInterface) JCSystem.getAppletShareableInterfaceObject(GinaAID,(byte)0);
              if( ff == null )
                   ISOException.throwIt((short)0x0903);
    if ( ff.getPinShareable().getTriesRemaining()== 0 ) return false;
    }My problem is in this line :
    "if ( ff.getPinShareable().getTriesRemaining()== 0 ) return false; "when I select my applet this line throw an exception, ff.getPinshareable includes all of OwnerPin methods(such as getTriesRemaining ,check ,reset, update ,...)but all of them throw exception .
    I think firewal does not allow other packages uses this methods .If my guess is right then what should I do for sharing the variables that they are defined with non primitive data type such as (OwnerPin,Signature,...)
    I'd appriciated for any help.
    yours sincerely,
    Orchid.
    Message was edited by:
    NewOrchid

    Applet 1:
    package com.package1;
    import javacard.framework.*;
    public class Applet1 extends Applet {
        private static final byte tryLimit  = (byte)3;
        private static byte[] pinBytes = {(byte)1, (byte)7, (byte)4, (byte)5, (byte)2};
        private Library1 lib;
        protected Applet1(byte bArray[], short bOffset, byte bLength) throws PINException {
            lib= new Library1(tryLimit, (byte)pinBytes.length);
            lib.update(pinBytes, (short)0, (byte)pinBytes.length);
            register();
        public static void install(byte[] bArray, short bOffset, byte bLength) {
            new Applet1(bArray, bOffset, bLength);
        public void process(APDU apdu) {
            byte status=(byte)0;
            lib.resetAndUnblock();
            if (!(lib instanceof Shareable)) status += (byte)2;
            if (!(lib instanceof MyPIN)) status += (byte)4;
            ISOException.throwIt(Util.makeShort((byte)0x90, status)); // sw indicates tries remaining
        public Shareable getShareableInterfaceObject(AID cltAID, byte parm) {
            return lib;
    }Library1:
    package com.package1;
    import javacard.framework.OwnerPIN;
    import javacard.framework.PINException;
    public class Library1 extends OwnerPIN implements Interface1{
        public Library1(byte tryLimit, byte maxPINSize) throws PINException {
            super(tryLimit, maxPINSize);
    }Interface1:
    package com.package1;
    import javacard.framework.PIN;
    import javacard.framework.Shareable;
    public interface Interface1 extends Shareable {
        boolean check(byte[] pin, short offset, byte length);
        byte getTriesRemaining();
        boolean isValidated();
        void reset();
    }Applet2:
    package com.package2;
    import javacard.framework.*;
    import com.package1;
    public class Applet2 extends Applet {
        private final static byte CLA_TEST = (byte)0x80;  
        private final static byte INS_TEST = (byte)0x20;
        private final static byte P1_AUTHORIZE = (byte)0x00;
        private final static byte P1_DOIT = (byte)0x01;
        private final static byte P1_CHECK_SIO = (byte)0x0a;
        private Interface1 sio;
        protected Applet2(byte bArray[], short bOffset, byte bLength) {
            register();
        public static void install(byte[] bArray, short bOffset, byte bLength) {
            new Applet2(bArray, bOffset, bLength);
        public void process(APDU apdu) {
         byte[] buffer = apdu.getBuffer();
            if ((buffer[ISO7816.OFFSET_CLA] == CLA_TEST) ||
                (buffer[ISO7816.OFFSET_CLA] == ISO7816.CLA_ISO7816)) {
                short bytesReceived = apdu.setIncomingAndReceive();
                switch (buffer[ISO7816.OFFSET_INS]) {
                case ISO7816.INS_SELECT:
                    if (!JCSystem.getAID().equals(buffer, ISO7816.OFFSET_CDATA, buffer[ISO7816.OFFSET_LC]))
                        ISOException.throwIt(ISO7816.SW_APPLET_SELECT_FAILED);
                    sio = (Library1)JCSystem.getAppletShareableInterfaceObject(JCSystem.lookupAID(<fill in parameters>);
                    if (sio == null)
                        ISOException.throwIt(ISO7816.SW_CONDITIONS_NOT_SATISFIED);            
                    break;
                case INS_TEST:
                    switch (buffer[ISO7816.OFFSET_P1]) {
                    case P1_AUTHORIZE:
                        if (!sio.isValidated()) {
                            if(!sio.check(buffer, ISO7816.OFFSET_CDATA, buffer[ISO7816.OFFSET_LC]))
                                ISOException.throwIt(Util.makeShort((byte)0x9A, sio.getTriesRemaining()));
                        break;
                    case P1_DOIT:
                        if (!sio.isValidated())
                            ISOException.throwIt(ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED);
                        sio.reset();
                        ISOException.throwIt(Util.makeShort((byte)0x9A, sio.getTriesRemaining()));                
                        break;
                    default:
                        ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2);                   
                    break;
                default:
                    ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
            else {
                ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
    }1. Upload package1
    2. Install Applet1
    3. Select Applet1
    4. Upload package2
    5. Install Applet2
    6. Select Applet2

  • Please help!! Can I pass a variable between 2 swf's that are on different html pages?

    Hey,
    Does anyone know how to pass a variable (string) from one swf
    to another if there in separate html pages?
    I assume I’d have to send the variable from the first
    page and load it into the second but I don’t know what
    functions or code I should be using. Any suggestions would be a
    HUGE help.
    Thanks
    If it helps: I’m creating a log in and sign up sheet
    that can be accessed from several sites. I’d like to record
    which site the user has come from when they signup.
    Thanks

    if they are open at the same time (for the same user), you
    can use the localconnection class to communicate between the
    two.

  • Sharing a Global variable between two Labview applicatio​ns

    Hello,
    A.exe and B.exe created by Labview 8.21. Both A.exe and B.exe run on the same PC. A and B exchanges data through a Global variable. Everything goes well if I launch both VI in Labview but when I try to launch the built executables A.exe and B.exe I get an error 1059. In B.exe I just use the Open Reference.vi icon to which I connect the path of the other application (A.exe) that already runs.
    So the general question here is: how can I open a reference to labview application A from another labview application B, both running on the same computer.
    Thanks for any hint,
    Christophe

    With a user ID# of 298, you have been using LV for quite a while.
    Review the release notes for LV 8.0 LV 8.2 etc and you will see that that two different exe's run in different contexts.
    I'd use a LV2 and VI server to read and write. VI Server will let you use TCP/IP to talk between the two contexts.
    Ben
    Message Edited by Ben on 01-15-2008 12:50 PM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Connect dispatchevent between two swf's??

    One single swf, imgdesc.swf is being loaded into the emptymcholder, by the moviecliploader instance.
    My order is
    folioholdermc ---holds--> emptymcholder --holds--> imgdesc.swf
    Within folioholdermc, I disabled buttons and lowered opacity, once imgdesc.swf was loaded, using onloadInit()
    Now  in the button inside imgdesc.swf. I called, this.unloadMovie(), which  successfully unloads the file, but I am still inside emptymcholder,  though I actually want to go back into folioholdermc.
    I  am trying out the use of Eventlistener to check for unloadMovie. But my  problem is can I place this within folioholdermc, within the  onloadInit() or maybe within the on(press) function which actually calls  the loader in the first place?? I need to enable the buttons within  folioholdermc, and increase opacity, once the imgdesc.swf is unloaded.
    Within the onLoadInit() in folioholdermc I added
    _mc.addEventListener("end",endClip);
             function endClip() {
                trace("end");    //plan to insert code to enable buttons and increase opacity here
    and in the imgdesc.swf within the back button
    on(press){
        this.dispatchEvent({target:this, type:"end"});
        trace("event dispatched");
        this.unloadMovie();
    how do I connect the two?? This is not working, as the endClip function is not being called. What am I doing wrong???

    Ok I figured it out. First mistake was that the code for dispatchevent was incomplete and placed in the wrong place, the first frame of the imgdesc.swf. The first frame of imgdesc.swf is apparently loaded before the onloadInit(), sending out an event which no one is listening to.
    So this is what I did within imgdesc.swf
    First Frame:
    import mx.events.EventDispatcher;
    EventDispatcher.initialize( this );
    stop();
    Then within the on(press) of the back button I inserted a gotoAndStop(2);
    Second Frame:
    this.unloadMovie();
    this.dispatchEvent({type:"end", target: this});
    trace("Child dispatching: end");
    Now in the onloadInit within the parent swf I wrote
    _mc.addEventListener("end", endClip);
            function endClip() {
                trace("end");
                i = 1;
                while (i<=30) {
                _root.folioholdermc["img"+i]._alpha = 100;
                _root.folioholdermc["img"+i].enabled = true;
                i++;
    Worked perfectly!! Hope this helps someone else who is stuck.

  • Send a variable from two .swf

    How do I send a variable from a.swl to b.swf
    Tkank
    Bruno

    I do not quite understand what you doing but if you return the default value for address and etc... that is type of varchar2, i guess all you have to do is to htp.p on your form? And if it needs to be in a textbox just render the appropriate html for that <input type = "text" value ="yourValue">

  • Unloading swf between two swfs.

    I have a UI that loads swf in the content area when several
    buttons are clicked (these buttons are menu1, menu2 et.c) the code
    is as follows and it is working fine...
    import fl.controls.Button;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import flash.events.MouseEvent;
    var loader = new Loader();
    var swfFile:String = new String();
    swfFile = "blank.swf";
    var req:URLRequest = new URLRequest(swfFile);
    loader.load(req);
    addChildAt(loader,1);
    menu1.addEventListener(MouseEvent.MOUSE_UP,menuRelease);
    menu2.addEventListener(MouseEvent.MOUSE_UP,menuRelease);
    menu3.addEventListener(MouseEvent.MOUSE_UP,menuRelease);
    menu4.addEventListener(MouseEvent.MOUSE_UP,menuRelease);
    function menuRelease(e:Event):void {
    this.removeChildAt(1);
    if (e.target.name == "menu1") {
    swfFile = "FM_main_menu_beta01.swf";
    } else if (e.target.name == "menu2") {
    swfFile = "FM_plan_menu_beta01.swf";
    } else if (e.target.name == "menu3") {
    swfFile = "FM_activity_menu_beta01.swf";
    } else {
    System.exit(0);
    req = new URLRequest(swfFile);
    loader.load(req);
    this.addChildAt(loader,1);
    So clicking the first button brings up a main menu in the
    main content area...with four menu options (buttons labelled
    mainMenu1, mainMenu2 etc.) When you click one of these main menu
    options, the corresponding swf should be loaded in place of the
    main menu (in the main contant area).
    However this is not happening and the main menu is staying
    around and not being unloaded. Is this because the main menu swf is
    in a loader created in the parent swf, but the main menu loader is
    in the main menu swf. So I think in effect i have two loaders
    appearing at the same time.
    import fl.controls.Button;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import flash.events.MouseEvent;
    var swfFile:String = new String();
    swfFile = "blank.swf";
    var req:URLRequest = new URLRequest(swfFile);
    var loader = new Loader();
    removeChildAt(1);
    loader.load(req);
    addChildAt(loader,1);
    mainMenu1.addEventListener(MouseEvent.MOUSE_UP,menuRelease);
    mainMenu2.addEventListener(MouseEvent.MOUSE_UP,menuRelease);
    mainMenu3.addEventListener(MouseEvent.MOUSE_UP,menuRelease);
    mainMenu4.addEventListener(MouseEvent.MOUSE_UP,menuRelease);
    function menuRelease(e:Event):void {
    removeChildAt(1);
    if (e.target.name == "mainMenu1") {
    swfFile = "FM_plan_menu_beta01.swf";
    } else if (e.target.name == "mainMenu2") {
    swfFile = "FM_activity_menu_beta01.swf";
    } else if (e.target.name == "mainMenu3") {
    swfFile = "blank.swf";
    } else {
    swfFile = "blank.swf";
    req = new URLRequest(swfFile);
    loader.load(req);
    addChildAt(loader,1);
    }

    bump

  • Communicate between two differente JavaFX desktop design file

    I have created two JavaFX desktop design file with netbeans 6.9.1. One is the login and the other de principal menu. In java i create a object of the principal menu an just call object.setVisible(true).
    So in javafx how to call the menu principal from the login?. what should i code in the btnLoginAction??
    this is the login javafx:
    function btnLoginAction(): Void {
    function run (): Void {
    var design = Login {};
    Stage {
    title: "Main"
    scene: design.getDesignScene ()
    }

    I'm not looking for a "tutorial created especially for me".... Just perhaps someone that can copy and paste some code from a similar project that they have done so I understand how to do it.
    You could have simply put here's a tutorial for how to use TweenLite to crossfade between four pages, and here's one that will let you pass information between two .swf files. If you recently watched the tutorials then it wouldn't take long to find them (maybe you have them bookmarked) and post a couple links.
    Anyways, I just found an excellent tutorial on how to crossfade using TweenLite (found here) and an article that explains how to pass information from one .swf to another (here). It took some searching and knowing exactly what I was looking for to find them, but that's a much better answer for someone looking to do those two things than I've found here (or elsewhere for that matter).

  • Fading between two pages & controlling one MC from another.

    Let me see if I can explain this properly. I usually use a motion tween and the alpha channel to fade movie clips in or out. What I am currently trying to do is fade one page out and another in, but it could be one of several MCs. I basically have four "pages" for a website including services, portfolio, about, and contact. I have icons on my navigation bar (which is going to be imported into my XHTML seperately so it can float them according to the users window size). The icons need to navigate between the pages and the pages need to fade in and out (eg. fade in the Services MC when the user clicks on the services icon, and fade out of it and into the Portfolio MC when the user clicks on the portfolio icon). Please keep in mind that the icons and pages are in completely different .fla/.swf files because I couldn't figure out how to float them in Flash after several hours of looking around online, but know I can easily do it using div tags + CSS in XHTML.
    If someone could quickly explain how to "gotoandplay" a label in a different .swf file (communicate between the .swf NavBar and my main .swf) as well as fade out of the current MC (whichever page the user is currently on) before fading into new page (according to the icon the user clicks on), I'm sure I could 'fill in the blanks' from the rest of the AS3 and Flash I already know. The page also needs to fade out of whatever page it's currently on when the user clicks on the hide button (located on the page in the main .swf file). There is also several subpages on each page (which shouldn't be a big deal if I can figure the rest of this out).
    I'm going to be using this same concept for nearly all of the websites I design & develop in the future and really need to know how to do this for the current site I'm working on. I would greatly appreciate any suggestions on how to accomplish these two things.
    P.S. Please keep in mind I'm not an advanced user in AS3, but am very computer savy, and have done my share of programming in the past. I looked around for hours online to try and complete this without using the forum, but have come up with links to dead tutorials and short answers left and right. I'm hoping I won't come across the same here.
    From what I've read so far I believe I can use tweening in ActionScript instead of a motion tween on the timeline to fade in and out of clips and believe that's the method to use to accomplish what I'm trying to do. Correct me if I'm wrong though.

    I'm not looking for a "tutorial created especially for me".... Just perhaps someone that can copy and paste some code from a similar project that they have done so I understand how to do it.
    You could have simply put here's a tutorial for how to use TweenLite to crossfade between four pages, and here's one that will let you pass information between two .swf files. If you recently watched the tutorials then it wouldn't take long to find them (maybe you have them bookmarked) and post a couple links.
    Anyways, I just found an excellent tutorial on how to crossfade using TweenLite (found here) and an article that explains how to pass information from one .swf to another (here). It took some searching and knowing exactly what I was looking for to find them, but that's a much better answer for someone looking to do those two things than I've found here (or elsewhere for that matter).

  • How can I get an ampersand to show up when between two other letters, in a text variable?

    Using Indesign CC 2014, on Windows 7.
    Creating a catalog.
    The company name is used throughout.
    Since this catalog will be re-branded for distributors at random, the company name will change all the time.
    So, here's a text variable I'm defining:
    The issue is that when I attempt to use an ampersand (&) between two letter with no spaces, the ampersand disappears.

    Yes!! You got it!
    Works. Thank you!
    Wish I'd thought of that . . .

  • Globale variable to exchange  value between two planning function (Formel)

    Hi,
    can I define a globale variable to exchange the value between two planning function?
    any anwser will be very appreciated.
    hongwei

    Hi,
    can I define a globale variable to exchange the value between two planning function?
    any anwser will be very appreciated.
    hongwei

  • Better estimation of phase difference between two signals with variable frequency!

    Hello LabView Gurus, 
    Being a power engineer and having just a little knowledge of signal processing and labview, I have been pulling my hair out for the last couple of days to get a better estimation of phase difference between two signals.
    We have two analog voltage signals; 1. sine wave (50Hz ± 1Hz) and 2. a square wave with exactly half of sine wave frequency at any time.
    At the starting point of operation (and simulation/acquisition) both signals will have no phase difference. However, the square wave's frequency changes unpredictably for a just a few millisecond but then it gets synchronized with sine wave's frequency again. This means that the square wave will be phased out from its original position. The task of the labview is to find the phase difference between the two signals continuously.
    My approach to determine the phase difference is to measure the time when sine wave crosses zero amplitude and the time when the very next square wave changes amplitude from zero volts to +ve voltage (I have a 0.5volts threshold just to avoid any dramas from small line noise). The difference between these times is then divided by the time period and multiplied by 360 to get this phase difference in angles. 
    As this part is just a small block of a big project, I can only allow 5000Hz sampling rate each for both signals. I read 500 samples (which means I read data from 5 cycles of sine wave and 2.5 cycles of square wave).
    Now the problem is, as long as the frequency of sine wave stays constant at exactly 50Hz, I get a good estimation of the phase difference but when the frequency changes even a little (and it will happen in the real scenario i.e 50Hz ± 1Hz  and the square wave's frequency is dependent of sine wave's frequency), the estimation error increases.
    I have attached my labview program. From front panel, you can set the phase of square wave (between -180 and 0) and you should see the labview's calculated phase in the indicator box named 'Phase'. Then you can press 'Real Frequency' switch that would cause the frequency to change like it would in real operation.
    You can observe that the estimation error increases after you push the button. 
    All I need to do is to reduce this estimation error and make it as close to the actual phase difference as possible. Any help would be greatly appreciated.
    I am using LabView 2009 for this task.
    The application is for electric machines and the stability/performance of machines under different faults.
    Thank you for reading this far!
    Regards,
    Awais
    Attachments:
    v603.png ‏320 KB
    v603.vi ‏186 KB

    Jeff Bohrer wrote:
    Basic math gives me a bit of pause on this approach.  You are sampling at 50 times the frequency of interest so you get 50 samples per cycle.  your phase resolution is 1/50th cycle or 7.2 degrees +/- noise.  You will need to samlpe faster to reduce phase resolution or average multiple readings (at a time cost that is signifigant)
    Jeff- (Hardly Working)
    I am sampling at 100 times the sine wave's frequency and 200 times the square wave's frequency.  Increasing the sampling rate completely solves my problem. But since I am acquiring several other inputs, I cannot afford a sampling rate higher than 5kHz.
    F. Schubert wrote:
    I'm not a signal processing expert, but here my basic understanding.
    If you simulate sampling with 5kHz and a frequency of 50 Hz (and both are 'sync' by design), you always get an exact 5 periods. Any variation of your signals frequency gives you a propability to get 4 or 6 'trigger' events. That's an up or down of 20%!
    The one measure to reduce such problems is using 'window functions'. They don't fit your current approach (counting instead of a DSP algorithm), so this needs to be reworked as well.
    My approach would be to use the concept of a Locki-In amplifier. You need to phaseshift your ref-signal by 90°. Then multiply your measurement signal with the ref signal and the phase shifted ref signal. The obtained values for x/y coordinates of a complex number. Calculate the theta of the complex number (with the LV prim). Feed this in a low pass filter.
    The trick on this is, that the square wave has harmonics in it, in this you are interested in the second harmonic which is the sine wave.
    To get rid of the effect that the sync between sampling rate and ref signal frequency gives an error, you then can use the window I mentioned above (place it before the lock-in).
    For a design that really plays well, use a producer-consumer design pattern to get the calculations done in parallel with the DAQ.
    I suggest you to check on wikipedia for some of the keywords I mentioned. Go also for the external links which lead to great tutorials and AppNotes on the signal processing basics.
    Sorry, it's not a simple solution I offer and we will have quite some conversation on this forum if you follow this path. Maybe someone else knows a simpler way.
    Felix
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml
    An interesting view. the sine wave can indeed be looked as a second harmonic of the square wave. I will implement your idea and get back to you as soon as I get some results. But since I have very limited knowledge of signal processing, it might take me a while to get my hear around the solution you mentioned.

  • How to pass variables between loaders

    Hi,
    I am trying to load an image, with descriptive text and a back button on the click of a thumbnail of the image. I am using a MovieClipLoader instance to do this.
    Here are my problems:
    1. I tried loading the image, with the text(which is within an external swf), using the same loader, but since I am placing them dynamically, depending on the dimensions of the image, I need to pass variables between the two. The image loader is taking longer than the text (obviously) but I need the dimensions of the image before I can place the text. How do I do that??
    2. I tried using two loaders, with separate listeners, and the problem once again is that the text loads before the image, and is hence placed with default values instead of the values derived from the image. The code is within onLoadInit(). Is it possible for me to get the dimensions of the image from onLoadStart()???
    3. There is a back button within the text.swf. I want the image and the text.swf to be unloaded when this button is clicked. How can I achieve that? Can I call loader.unloadClip(target), from within this? Will it recognize the variable?
    4. Is there a much easier way to do this, which I am sadly unaware of?
    Any help will be appreciated.

    Tried the onloadstart() function, but it gives target._width and _height as 0. So that is ruled out...any other suggestions?

Maybe you are looking for

  • Org Unit not defaulting in 0001 after running RHINTE 30

    Dear SAP Gurus, We are facing a problem where in Org Units in Infotype 0001 are not getting defaulted after running the RHINTE reports. We have done the integration between OM <--> PA, however after running the RHINTE reports the org unit is shown as

  • JSC deployment question.

    I have a situation where after my JSC created application is deployed, I need to have the ability to access PDF files that I give the user of my application the ability to select in a listbox. At development time, the names and locations of these PDF

  • RE: To change the invoice approver in the PO

    Hi All, If you want to change the invoice approver in the PO it is possible to change it by putting a e-mail address direct in - the search field with the field glass is not working. It brings no values if you put a name in Thanks Madhav

  • SQL install on Cluster

    Dear Team, we got a error while installing sql on cluster We just want to clarify that "where do we install sql,on clustered shared drive or local drive?" Our setup is like below. Having two nodes clustered on one IP, and two shared drives(Clustered

  • New iPad and pages

    Does the new iPad allow track changes for pages?