Can a component use a main app's dataservice?

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default Can a component use a main app's dataservice?

    I have several components that require the same dataservice and arraycollection
    to populate a control on each component.
    Here's how my dataservice and arrayCollection are declared and populated
    private var ds:DataService;
    private var items:ArrayCollection;
    private var item:ItemTable;

    items = new ArrayCollection;
    ds = new DataService("someDS");
    ds.fill(items);
    item = new ItemTable;

    I'd like to have this all in my main application, and then let my components
    use it. How can I call this dataservice and arraycollection from my main app
    to my components?



    EvolvedDSM Guest

  2. Similar Questions and Discussions

    1. Problem accessing results from DataService fill method
      I've set up an application that gets data from a data service configured with a java-dao adapter. If I define a DataGrid with the array populated...
    2. Component function returntype as component name.
      How does the returntype as a component effect the function and the actual return? Is this the same as extending another component? Can someone...
    3. How to make a protected property in the base component public in the derived component?
      I have a base component, from which several components derive. What I want is to just publish some of the protected properties in the base...
    4. Need Tab Component - Flash MX DevNet Kit #3 / UI Component Set 5
      I need the Tab Component that comes with DevNet Kit #3 (UI Component Set 5). I don't need anything else, just the Tab Component., and I can't afford...
  3. #2

    Default Re: Can a component use a main app's dataservice?

    I would think that using parentDocument.items, etc. or Application.aplication.items you could do this, but I wonder if the fact that they are private may prevent access. They might need to be public.
    Greg Lafrance Guest

  4. #3

    Default Re: Can a component use a main app's dataservice?

    Thanks Greg. Turning the variables public and using parentDocument did the trick!
    EvolvedDSM Guest

  5. #4

    Default Re: Can a component use a main app's dataservice?

    I would think that as long as the array collection has an id, such as myAC, then it would be compName.myAC.refresh().
    Greg Lafrance Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139