Simple SharedObject question (I think)

I am trying to understand how to write and read from the SharedObject to remember a login.
This was simple in Flex Builder 3, used the wizard and it built the login plumbing whether you wanted it or not.
I tried to get something from the video below, but obviouly there is more.
I run the code below and get:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at logtest/saveData()[C:\Inetpub\wwwroot\tiptest\src\logtest.mxml:26]
at logtest/___logtest_Button1_click()[C:\Inetpub\wwwroot\tiptest\src\logtest.mxml:48]
The sharedobject is null.
What am I not understanding.
http://tv.adobe.com/watch/adc-presents/using-shared-objects-in-flex-applications
<?xml version="1.0" encoding="utf-8"?>
<s:Application 
xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="
library://ns.adobe.com/flex/spark" xmlns:mx="
library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<s:layout>
<s:BasicLayout/>
</s:layout>
<fx:Script>
<![CDATA[
import flash.net.SharedObject; 
private var sharedObj:SharedObject; 
private function initSharedObject():void
SharedObject.getLocal(
"myContacts" ); 
if ( sharedObj.size > 0 ){
txtArea.text = sharedObj.data.contacts;
private function saveData(event:MouseEvent):void
sharedObj.data.contacts = txtInput.text;
sharedObj.flush();
lbl.text =
"Data Stored Locally";}
private function deleteData(event:MouseEvent):void
sharedObj.clear();
lbl.text =
"Local Data Deleted";}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:TextArea x="268" y="120" id="txtArea"/>
<s:Label id="lbl" x="268" y="279" width="161">
</s:Label>
<s:Button x="160" y="341" label="Save" click="saveData(event)"/>
<s:Button x="249" y="341" label="Delete" click="deleteData(event)"/>
<s:Button x="344" y="341" label="Button"/>
<s:TextInput x="268" y="68" id="txtInput"/></s:Application>

I added the creation complete and get this error now. I don't know what you mean by "storing of the Shared Object in the sharedObject property"
<s:Application 
xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="
library://ns.adobe.com/flex/spark" xmlns:mx="
library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"creationComplete="initSharedObject()"
>
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at logtest/initSharedObject()[C:\Inetpub\wwwroot\tiptest\src\logtest.mxml:19]
at logtest/___logtest_Application1_creationComplete()[C:\Inetpub\wwwroot\tiptest\src\logtest .mxml:5]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.x\frameworks\projects\framework\src\mx\core \UIComponent.as:12528]
at mx.core::UIComponent/set initialized()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\UIComponent.as:1627]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.x\frameworks\projects\framewo rk\src\mx\managers\LayoutManager.as:759]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.x\frameworks\projects \framework\src\mx\managers\LayoutManager.as:1072]

Similar Messages

  • Simple audio question (I think)

    Thanks everyone for answering this question which I think is fairly simple. I have a new TV that I use as the monitor for my computer and connect my Itv to. Currently I have both the cable, my computer and ITV hooked up through HDMI. Whenever I switch between the different HDMI inputs I obviously do not continue getting the sound out from my ITV. The question is I would like to be able to leave my ITV running while it is playing music to my stereo and surf the internet with my computer output on the screen. I know I could obviously play Itunes on my computer however the ITV seems to have much better output quality. Anyone has a solution for this?
    I look forward to your answers. Have a great day and thanks again.
    Message was edited by: mameares

    Welcome to the  Discussion Forums.
    Not without some other device to feed audio through. Your tv will only play from one input at a time, when you switch to the input from your mac/pc, it will always cut off the audio from other inputs.

  • Simple OAM questions (I think):  Possible to delete users and groups?

    Hi,
    I was wondering if, using the OAM admin, is it possible to delete a user?
    Same question regarding a group?
    For users, it seems like I can deactivate a user, but can't delete using the OAM admin?
    Thanks,
    Jim

    Deleting User:
    1. Create a "Deactivate User" work flow to deactivate the user account.
    2. Locate the deactivated user account from "Deactivated User Identity" link in User Manager.
    3. Select the user account you want to delete, click the Delete button to delete.
    Deleting Group:
    1. Create a "Delete Group" workflow in the workflow definition. Step1: Initial - Specifiy who can initialize the process; Step 2: Commit - commit the action.
    2. In the group information panel, click the Delete button to delete the group.

  • Simple SQL question (I think)

    I have an SQL newbie question. I have a select query into a table (T1) that contains 2 id numbers (sender and receiver), in addition to other information. The id numbers are mapped, in a separate table (T2), to names. So, we have table T1 with data columns transactionTime (timestamp), sender id (varchar(10)), receiver id (varchar(10), and additional info in each row about transactions. Table T2 has two columns ... name (varchar(60)) and id (varchar(10)), where the id is the same as senders and receivers in the transaction table. I'd to find all transactions between a start timestamp and an end timestamp, and I would like to also display the name associated with each id.
    So, as a newbie, I tried (simplified)
    select T1.transactionTime, T1.sender, T2alias1.name, T1.receiver, T2alias2.name
    from T1, T2 as T2alias1, T2 as T2alias2
    where T1.transactionTime > timestamp('aStartTime') and T1.transactionTime < timestamp('anEndTime')
    and T1.sender = T2alias1.id and T1.receiver = T2alias2.id
    order by T1.transactionTime
    This returns some of the rows between the start and end time, but only seems to get records for a single sender, and not all of those.
    I've also tried
    where T1.transactionTime > timestamp('aStartTime') and T1.transactionTime < timestamp('anEndTime')
    and (T1.sender = T2alias1.id or T1.receiver = T2alias2.id)
    but that takes a long time to return, and returns more results then there are records in the transaction table.
    I obviously am not do this correctly. I just want to get the name associated with the ids. Any help?
    None of these look quite right to me, and none return the the data I am looking for
    ¦{Þ                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi,
    This query should give you correct results if, there are all assciated id's and names for both senders and recievers in table2.
    SELECT t1.transactiontime, t1.sender,t21.NAME,t1.reciever, t22.NAME
      FROM t1, t2 t21, t2 t22
    WHERE     t1.transactiontime BETWEEN timestamp(startdate) and timestamp(enddate)
           AND t1.sender = t21.ID
           AND t1.reciever = t22.ID;if either sender's ID or Recievers ID are missing in table2, the whole record will get ignored.
    You can try an outer Join get records even if the ID's are missing in table2.
    SELECT t1.transactiontime, t1.sender,t21.NAME,t1.reciever, t22.NAME
      FROM t1, t2 t21, t2 t22
    WHERE     t1.transactiontime BETWEEN timestamp(startdate) and timestamp(enddate)
           AND t1.sender = t21.ID(+)
           AND t1.reciever = t22.ID(+);if you want to know the missing ID's the add a IS NULL caluse.
    SELECT * FROM(
    SELECT t1.transactiontime, t1.sender,t21.NAME name1,t1.reciever, t22.NAME name2
      FROM t1, t2 t21, t2 t22
    WHERE     t1.transactiontime BETWEEN timestamp(startdate) and timestamp(enddate)
           AND t1.sender = t21.ID(+)
           AND t1.reciever = t22.ID(+))
      WHERE  name1 IS NULL or name2 IS NULL;G.

  • Simple threads question (I think)

    I searched all over the forum, but wasn't able to find an answer for this question, so here it is:
    I simply wanna slow down execution of a loop. I'm been playing with threads to try and do this using wait(long) but I always get the current thread not owner exception...
    Same thing when I tried it with Runtime.wait(long) or System.wait(long). Can anyone offer any suggestions?

    I simply wanna slow down execution of a loop. To do this, use Thread.sleep:
    //start doing something
    try {
      Thread.sleep(100);
    catch (InterruptedException e) {}
    //carry on doing somethingThe above code will cause the currently executing thread to go to sleep for 100 milliseconds (It will actually sleep for an arbitrary time of at least 100ms, so you can't use it as a timer, but for slowing something down, it'll do the job fine).
    I'm
    been playing with threads to try and do this using
    wait(long) but I always get the current thread not
    owner exception...Using wait if you don't properly understand it is a very bad idea. It is used when you need an object to be in some consistent state before continuing execution: The current thread waits for some other thread to change the object's state and notify it that a change has been made, before waking up and re-checking the object's state (This isn't all done by the wait method alone, but this is the situation in which you would use it). If you don't know how to use it properly, you are likely to cause a deadlock or contention problem.
    You are getting the error because when you call an object's wait method, you must first own that object's lock (i.e. be inside a block of code that is synchronized on that object). When a thread calls wait, the object adds it to its pool of waiting threads, and when notify (or notifyAll) is called on the object, it wakes up one (or all) of the threads in its waiting thread pool. The newly wawoken thread(s) then go into the ready state and try to get the lock back before continuing execution.
    The long argument to wait is a (non-strict) maximum time that the thread should wait for before it wakes up anyway, whether or not notify has been called.
    Same thing when I tried it with Runtime.wait(long) or
    System.wait(long). Can anyone offer any >suggestions?Runtime.wait and System.wait should both not compile, giving an error that you are trying to call a non-static method from a static context (or something similar).

  • Simple AS3 question (I think)

    Hi,
    I made a simple page with several buttons that play music, but then decided I wanted a video (flv) to first play automatically, and when that ends the page with the buttons appears. How can I do that? Right now I have four layers using one frame. Layer one has the AS code, two has the text, three has the buttons and the fourth layer has a background image.
    Thanks in advance

    slowly making progess. My code (should play video then go to frame 2 where the page of buttons appears)
    flv.source="New Clip.flv";
    flv.addEventListener(VideoEvent.COMPLETE,videoCompleteF);
    function videoCompleteF(e:Event){
    gotoAndPlay(2);
    But I get the error:
    flv.addEventListener(VideoEvent.COMPLETE,videoCompleteF);

  • Simple AppleScript question I think

    I have hundreds of jpg images some with but most without the .jpg extension. I'm not great at script writing to be honest. I can write the initial part that changes the name of one file but who couldn't. My bigger problem is I need to to go through multiple folders and add the extension to the images that need it.
    I was trying to fix my artwork in iTunes for CD art. In some cases the art downloaded art is wrong I have the artwork due to a database I am running, but in the older system OS the extensions weren't a deal breaker. But now it seems to be an issue.
    So my folders are as follows:
    CD Art
    Then genre like Rock/Pop
    Tthen band name
    Inside that folder would be the images all of which I know to be jpg's
    it would be awesome to have it go to "CD Art" and then go through all the folders and sub folders and add .jpg to the images that are missing the extension.
    Ken

    Aslink wrote:
    Thank you so much for your time however after re creating this in automator and running it nothing happened to my image files. I may not understand anything that was typed but I know I can copy and paste.
    Ken
    Lets debug it.
    Use this in the Run Shell Script Action:
    for f in "$@"
    do
      if [ "${f%.*}" = "$f" ] ; then
           t=$( file -b "$f" | cut -d ' ' -f1 )
           echo "$t" "$f"
      fi
    done
    Then after it runs, click [Results] in the Run Shell Script Action.
    This will give a list of the type of all files without extensions and the location.
    Are you seeing any JPEG listed?

  • 2 Simple FCE Questions

    Hey, I'm kind of a noob at final cut and have 2 questions I think should be relatively simple to answer.
    1. How can I make the audio clip stay with the video clip? For example if I move a video clip 5 seconds down the timeline, the audio clip that goes to that video clip doesn't move. The audio clip then has a red box on it that says its 5 seconds out of sync with the video clip. How can I make them move as one?
    2. I took a 10 second clip in iMovie and cut out 8 seconds of it, so I'm left with a 2 second clip. When I drag that 2 second clip into Final Cut it's the old 10 second clip and not the cut down version. Any ideas on fixing this as well?
    Thank you

    1. Make sure linked selection is switched on. It's normally on by default. Leave it on. Little chain link button in the upper right of the timeline window.
    2. You can't drag and drop from iMovie. If you dragged from the finder you'll loading the original media file. iMovie, like FCE, is a non-destructuve editor.

  • A few simple Logic questions...please help.

    I have a few probably simple Logic questions, that are nonetheless frustrating me, wondering if someone could help me out.
    1. I run Logic 8, all of the sounds that came with logic seem to work except organ sounds. I can't trigger any organ sounds (MIDI) on Logic, they won't play. I have a Yamaha Motif as my midi controller.
    Any idea why?
    2. I've starting running into a situation where I will record a MIDI track, the notes are recorded but they won't playback. The only track effected is the one that was just recorded. All other midi tracks playback.
    I have to cut the track, usually go out of Logic and back in, re record for it to playback properly. Any idea why this may be happening?
    3. How important is it to update to Logic 9. Are there any disadvantages down the road if I don't upgrade. If I purchase the $200 upgrade, do I get a package of discs and material, or it just a web download.
    Any help is appreciated!
    Colin

    seeren wrote:
    Data Stream Studio wrote:
    3) You get a full set of disks and manuals.
    They're including manuals now?
    I think his referring to the booklets ...on how to install etc
    It would be great to see printed manuals though ...I love books especially Logic/Audio related !!
    A

  • Simple Quick Question

    wrong section, post was moved.
    Message was edited by:
    Rob17

    you titled "simple quick question"...
    .. complicated to answer..
    a) the TermsOfUse of the iTS don't allow any processing of purchased files, these are "copy protected"..
    b) iM has a voice-over function..
    c) iM is a video-edit app.. easy to use... just learn to handle it...
    d) iM allows to "extract" audio (=muting the original audio, adding your own..)
    e) to learn iM, spend some time here: http://www.apple.com/ilife/tutorials/imovie/index.html
    f) use pencil and paper first! WRITE and scribble, what shall happen when in your movie/parody... make a script, draw a storyboard .. THEN launch iM.. in other words: think first, then edit.. iM is just a tool, it does not "create"... Picasso needed a papertowel and half a stencil to create art....
    g) to get comfortable with iM, start with your own, small, short (3min!) project... import some stills, edit them, add a funny voice-over, add sounds, add music... good? make a bigger one...
    h) .. in our Lecture II, we teach you how to import shows from TV, youtube, wherever..
    standard disclaimer:
    be nice to ©opyrights ...

  • Simple/silly question: how do I set/change default font/color for outgoing mail messages?

    Simple/silly question: how do I set/change default font/color for outgoing mail messages?

    Just a suggestion..........
    Download Thunderbird.  Easier to use when it comes to what you want to do w/your emails. 

  • 4 Simple Flash Questions that Are Stumping Me!

    What is the Frame Rate for Web Animations
    Q1. I am making an animation which will be played on the web. What is the default frame rate (fps) of Flash CS5? And what is the frame rate of for web?
    Q2. My animation needs to be 30 seconds long. So at 15 fps that would mean I need to use 600 frames in Flash?
    How Do I Mask everything so all I see is the Content on the Stage?
    I have a wide image that extends past my movies stage size so when I preview my movie the image is visible. How do I mask out anything that extends past my movies window size? I believe I can create a layer named "mask" and place it above all other layers, but I forget how to make the mask. Any help is appreciated.
    How to Fade a Graphic
    I have a graphic element (some type) and I want it to fade from 0% to 100%. In older versions of Flash I could just select the symbol and then set it's alpha value to 0%, move a few keyframes and then set the alpha to 100%. Voila! but now it doesn't seem to work that way. How can I do this in CS5?

    Ned, it says 24 fps which means there is 24 frames per second so each 24 frames is 1 second.
    Date: Fri, 4 Nov 2011 05:35:16 -0600
    From: [email protected]
    To: [email protected]
    Subject: 4 Simple Flash Questions that Are Stumping Me!
        Re: 4 Simple Flash Questions that Are Stumping Me!
        created by Ned Murphy in Flash Pro - General - View the full discussion
    1 You can create your character as a movieclip and copy/paste that movieclip from one file to another. 2. One way to create a movieclip is to copy all the frame of the animation's timeline (select them all, right click the selection, choose Copy Frames), then create a new movieclip symbol (Insert -> New Symbol...etc) right click on its only keyframe and chhose Paste Frames.  THat will put all the layers and frames you copied into the movieclip The only way to come close to being certain about the timing of you animation is to use code to keep track of the time, something like getTimer()..  The frame rate that a file plays at is not a reliable means of dictating the time it takes due to a variety of factors which include the amount of content you are trying to process and performance limits of the user's machine.
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4007420#4007420
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4007420#4007420. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Flash Pro - General by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Simple performance question

    Simple performance question. the simplest way possible, assume
    I have a int[][][][][] matrix, and a boolean add. The array is several dimensions long.
    When add is true, I must add a constant value to each element in the array.
    When add is false, I must subtract a constant value to each element in the array.
    Assume this is very hot code, i.e. it is called very often. How expensive is the condition checking? I present the two scenarios.
    private void process(){
    for (int i=0;i<dimension1;i++)
    for (int ii=0;ii<dimension1;ii++)
      for (int iii=0;iii<dimension1;iii++)
        for (int iiii=0;iiii<dimension1;iiii++)
             if (add)
             matrix[i][ii][iii][...]  += constant;
             else
             matrix[i][ii][iii][...]  -= constant;
    private void process(){
      if (add)
    for (int i=0;i<dimension1;i++)
    for (int ii=0;ii<dimension1;ii++)
      for (int iii=0;iii<dimension1;iii++)
        for (int iiii=0;iiii<dimension1;iiii++)
             matrix[i][ii][iii][...]  += constant;
    else
    for (int i=0;i<dimension1;i++)
    for (int ii=0;ii<dimension1;ii++)
      for (int iii=0;iii<dimension1;iii++)
        for (int iiii=0;iiii<dimension1;iiii++)
           matrix[i][ii][iii][...]  -= constant;
    }Is the second scenario worth a significant performance boost? Without understanding how the compilers generates executable code, it seems that in the first case, n^d conditions are checked, whereas in the second, only 1. It is however, less elegant, but I am willing to do it for a significant improvement.

    erjoalgo wrote:
    I guess my real question is, will the compiler optimize the condition check out when it realizes the boolean value will not change through these iterations, and if it does not, is it worth doing that micro optimization?Almost certainly not; the main reason being that
    matrix[i][ii][iii][...]  +/-= constantis liable to take many times longer than the condition check, and you can't avoid it. That said, Mel's suggestion is probably the best.
    but I will follow amickr advice and not worry about it.Good idea. Saves you getting flamed with all the quotes about premature optimization.
    Winston

  • Question: I think I made mistakes using several different id apple. How can I cancel all of them except the one I would like to maintain ?

    Question: I think I made mistakes using several different id apple. How can I cancel all of them except the one I would like to maintain ?

    From Here   http://support.apple.com/kb/HE37
    I have multiple Apple IDs. Is there a way for me to merge them into a single Apple ID?
    Apple IDs cannot be merged. You should use your preferred Apple ID from now on, but you can still access your purchased items such as music, movies, or software using your other Apple IDs.

  • Quick Easy Question- I think...

    If you have 15 expressions, concatenated by Boolean OR's, how many of the expressions must be true for the entire thing to be true? My friend and I are arguing whether the answer is...
    a. at least 1
    b. all of them
    c. cannot be determined
    Thank you so much for your input. We are studying for an exam, trying to finish the practice questions. I appreciate any input and your time!! :-)

    Hi,
    Programming languages are created by humans, and therefore it is usually pretty easy to answer such questions. Think about the human language..
    Do you have a car or a house or a space ship?
    Any one who owns a car or a house would answer yes, even if they didn't own a space ship. That is, the whole expression evaluates to true if one of the statements is true.
    /Kaj

Maybe you are looking for