RE: [flexcoders] Re: Unbelievably embarassing question - making components talk (and modules) amongst

2007-03-19 Thread Tracy Spratt
First, bigImage.source={data.piclink}; will not work.  You cannot
use binding braces in AS code. 

 

Second, where is the data object you reference in that line?

 

I suspect you really want something like:

public function thumbChanged(event:Event):void {

  var xmlData:xml = XML(event.target.selectedItem);

  var sPicLink:String = [EMAIL PROTECTED];
  Application.application.galleries_module1.imagetabs.bigImage.source =
sPicLink;
 
Application.application.galleries_module1.thumbloader.thumbService.send(
);

 

Tracy



 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of shawn.gibson
Sent: Sunday, March 18, 2007 1:39 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Unbelievably embarassing question - making
components talk (and modules) amongst

 

OK well I'm I guess one or two lines from making the 'simple' version 
work. When I hard-code the following in my thumbChanged method, it 
works...well if loading the same image no matter what thumb you click 
means it works LOL:

Application.application.galleries_module1.imagetabs.bigImage.source=a
ssets/galleries/CD2.jpg;

But when I try to grab the proper {data.piclink} which corelates to 
the thumblink after clicking (i.e., the right image in the XML file), 
I get, well, nothing, not even an error LOL...but no image 
either...it DOES make the broken image link go blip, but it doesn't 
load. Here's what I am trying to do, but please keep in mind, with 
this sort of thing, I still have absolutely no idea what I'm doing 
yet (the source code in the HBox works, but my thumbChanged method is 
frying):

mx:Script
![CDATA[

import mx.containers.HBox;//???
import mx.core.Application;
//import mx.core.Application;

[Bindable]
public var selectedThumb:XML;

// Event handler for the Tree control change event.
public function thumbChanged(event:Event):void {

Application.application.galleries_module1.imagetabs.bigImage.s
ource={data.piclink};

Application.application.galleries_module1.thumbloader.thumbSer
vice.send();

//Application.application.galleries_module1.imagetabs.bigImage
.source={data.piclink};
//selectedHBoxItem=HBox(event.target).selectedThumb 
as XML;
//Application.application.thumbService.lastResult.galle
ry.piece.piclink.url=selectedThumb.piclink;
// parentDocument.thumbloader.thumbService.send();
//Application.application.thumbService.send();
};

]]

/mx:Script

mx:HBox click=thumbChanged(event);
id=thumbbox width=100% height=100% 
verticalAlign=middle verticalGap=0
verticalScrollPolicy=off horizontalAlign=center 
backgroundColor=#00 backgroundAlpha=0.0
mx:Image id=img source={data.thumblink} 
horizontalAlign=center verticalAlign=middle height=75%/
/mx:HBox
/mx:Canvas

As usual, the source is available if I'm clear as mud...I'd really 
appreciate any help here, because I've spent all weekend on it and 
I'm just totally lost: 

http://www.shawngibson.com/faceitphoto.ca/shawn/index.html
http://www.shawngibson.com/faceitphoto.ca/shawn/index.html 

(click the Galleries button, anything else will probably blow up...)

Shawn

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Tracy Spratt [EMAIL PROTECTED] wrote:

 Yes, also Application.application will give you a reference to the
 top-level application. As I said in my other post, there are many 
ways.
 
 Tracy
 
 
 
 
 
 From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com

[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
] On
 Behalf Of shawn.gibson
 Sent: Thursday, March 15, 2007 6:15 PM
 To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 
 Subject: [flexcoders] Re: Unbelievably embarassing question - making
 components talk (and modules) amongst
 
 
 
 I'm sure it goes deeper than this (if you'll pardon the pun), but 
if 
 you add 'parentDocument' to your parent (i.e., 
 parentDocument.thumbloader.etc you get the kind of thing I'm 
hoping, 
 at least for component-to-component-from-within-the-same-module.
 
 I typed the name of the error message into the help screen. Go 
 figure :S
 
 Shawn
 
 --- In flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  mailto:flexcoders%
40yahoogroups.com
 , shawn.gibson shawn.gibson@ 
 wrote:
 
  Thanks to Tracy's earlier help, I was able to get at least the 
ugly 
  (i.e., my) version of HTTPService going (and I'll revisit it to 
  Tracy's specs one I figure this here problem out), but in order 
for 
  me to do it, I had to de-compartmentalize all my code. In other 
  words, I have originally been using an approach where each 
  major 'page' was a module loaded into a state of my main app, and 
  each major chunk of a module was made of a custom component (the 
  entire Tree, it's code, the little stuff; or the entire thumbnail 
  with all it's itemrendering in a HorizontalList...etc)- nice 
  separation of code, easy to understand in 6 months, and no 6,000 
 line 
  files

RE: [flexcoders] Re: Unbelievably embarassing question - making components talk (and modules) amongst

2007-03-15 Thread Tracy Spratt
Yes, also Application.application will give you a reference to the
top-level application.  As I said in my other post, there are many ways.

Tracy

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of shawn.gibson
Sent: Thursday, March 15, 2007 6:15 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Unbelievably embarassing question - making
components talk (and modules) amongst

 

I'm sure it goes deeper than this (if you'll pardon the pun), but if 
you add 'parentDocument' to your parent (i.e., 
parentDocument.thumbloader.etc you get the kind of thing I'm hoping, 
at least for component-to-component-from-within-the-same-module.

I typed the name of the error message into the help screen. Go 
figure :S

Shawn

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, shawn.gibson [EMAIL PROTECTED] 
wrote:

 Thanks to Tracy's earlier help, I was able to get at least the ugly 
 (i.e., my) version of HTTPService going (and I'll revisit it to 
 Tracy's specs one I figure this here problem out), but in order for 
 me to do it, I had to de-compartmentalize all my code. In other 
 words, I have originally been using an approach where each 
 major 'page' was a module loaded into a state of my main app, and 
 each major chunk of a module was made of a custom component (the 
 entire Tree, it's code, the little stuff; or the entire thumbnail 
 with all it's itemrendering in a HorizontalList...etc)- nice 
 separation of code, easy to understand in 6 months, and no 6,000 
line 
 files. Also offered me a fighting chance in the future to figure 
out 
 model, control, and view separation.
 
 But for me to get (for example) the tree component I made to 
 communicate with the thumbnail component, both housed in the 
 galleries module, I had to hardcode the components back into the 
 module (i.e., they are no longer components), so the module is now 
 one big-ass file that has no components, they are right in the 
file. 
 
 I can't go on like this, it's just too ugly. As a designer and a 
poet 
 wannabe, that sucks LOL.
 
 But I can't for the life of me get things to talk amongst 
themselves, 
 say my module has 3 custom components doing their things...how do I 
 access something in one component from another component?
 
 I became very afraid when I realized there doesn't seem to be any 
 kind of AS2/Flash dummy-movie approach - loadMovie ('thisthing') 
into 
 dummyclip instance 'whatever' and suddenly you just say 
 whatever.thisthing.stuff, and you've gained access to everything. 
In 
 other words, you can jump up and down as long as you know the 
scope. 
 I haven't a clue what the equivalent is in Flex 2.
 
 It's very embarassing. I refuse to get through this weekend without 
 figuring it out. I'm not botching my gallery project by having 5-6 
 modules (as I DO want) but with thousands of hardcoded chunks 
within 
 them, when each module should by rights have nice piecemealed 
(sorry 
 for the word) custom components doing their thing from their own 
file 
 and from there communicating with each other. I need to use 
 components in the modules for my own sanity, and even worse, how do 
I 
 get one module to talk to another module's objects, functions, etc.?
 
 In a word, you can't go from:
 
 [EMAIL PROTECTED];
 srv.send();
 
 ...strip it out into a component and then call the id of the 
parent, 
 i.e.:
 
 [EMAIL PROTECTED];
 thumbloader.srv.send();
 
 ...you get Access of undefined property thumbloader for your 
 troubles...
 
 You can't back up a generation like you could with Flash. Or if you 
 can, I'm missing big bits of the puzzle.
 
 Any suggestions, other than take a chill-pill?
 
 Thanks guys,
 
 Shawn