[flexcoders] Droppable areas

2009-11-23 Thread bgamblin
Sorry to bother you guys again, but I never found an answer for my strange 
droppable region problem.

The situation is that I have Boxes that respond to dragOver and dragDrop 
messages. However, the dragOver message doesn't get fired over the whole 
object. The area that generates a dragOver message seems to change based on how 
many children are added to the box. However, even that seems to be inconsistent.

Noting in the source that the dragOver event seems to be called within the 
mouseOver event for dragProxy, I tested the theory by putting a listener on 
mouseOver, which displayed the same problem. So, what defines a valid region 
for a mouseOver event?



[flexcoders] Re: Odd DragOver Problem

2009-11-11 Thread bgamblin


Thank you for the help. I have a dragEnterHandler function which is called 
upon the main container's DragEvent.DRAG_ENTER event. The dragEnterHandler is 
the only place where acceptDragDrop is called, but that handler is only called 
when I'm on the left side of the container. I'm looking through the Flex source 
now to see when exactly the DRAG_ENTER event is dispatched.

It's worth noting that the dead zone changes as the size of the control 
changes. It's not half of the container size, but around 60% of the length.

Thank you again for your assistance.


--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 Double check your logic about when you call acceptDragDrop
 
 Alex Harui
 Flex SDK Developer
 Adobe Systems Inc.http://www.adobe.com/
 Blog: http://blogs.adobe.com/aharui
 
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On 
 Behalf Of bgamblin
 Sent: Tuesday, November 10, 2009 8:54 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: Odd DragOver Problem
 
 
 
 Well, I hate to sound ditzy here, but I didn't actually fix all the problems 
 by changing the background color. That fix stabilized the problem, making it 
 so that the dead zones no longer seem random. However, it is now a situation 
 where there is a definite cutoff about midway through the main HBox. Anything 
 to the left of center will create a DragOver event. Anything to the right, 
 won't.
 
 Has anybody seen this issue?
 
 --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, 
 bgamblin BrandG@ wrote:
 
  Never mind. I figured it out. I totally forgot that for something to be 
  droppable, it has to be a visible component. In this case, setting the 
  background color to anything at all makes it a droppable target.
 
  Sorry for the interruption.
 
 
  --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, 
  bgamblin BrandG@ wrote:
  
   Say you have an HBox, and inside that HBox you have lots of little child 
   HBoxes. Now, you want to rearrange the child HBoxes using drag and drop. 
   Using Flex, it's pretty easy to enable drag/drop support. However, the 
   dragover event seems to fire at odd points.
  
   As I drag a child HBox around the main HBox, I sometimes see the invalid 
   drag icon, even though it should be valid. If it disallowed dragging one 
   child over another, I could understand that. But even that seems random, 
   with some portions of the children showing as valid drag targets, and 
   others not. With a small number of children, it was odd but not 
   debilitating. With a large number of children, it became entirely 
   untenable. If I have ten children, I can't drop the items anywhere except 
   the first half of it's width.
  
   Is there another element to this that affects where an object becomes a 
   drop target or not? Variable width perhaps? Padding? I'm at a loss.
  
 




[flexcoders] Re: Odd DragOver Problem

2009-11-11 Thread bgamblin
I'm not overriding CreateChildren, but I'd be glad to post the code I'm using.

Here's the function for when the main container is created:

public function ColumnArranger()
{
super();
this.setStyle(borderStyle,solid);
this.setStyle(borderThickness,1);
this.setStyle(backgroundColor,#1B4B6A);
this.percentWidth = 100;

addEventListener( DragEvent.DRAG_ENTER, dragEnterHandler );
addEventListener( DragEvent.DRAG_DROP, dragDropHandler );
addEventListener( DragEvent.DRAG_OVER, dragOverHandler );
addEventListener( DragEvent.DRAG_EXIT, dragExitHandler );
}

This is the function for the addition of children:

public function populateData(columnArray:Array):void
{
var currBox:HBox = null;
var currLabel:Label = null;
var currCheckBox:CheckBox = null;

for each (var currValues:Object in columnArray) {
currBox = new HBox();
currBox.setStyle(horizontalAlign,center);
currBox.setStyle(borderStyle,solid);
currBox.setStyle(borderThickness,1);
currBox.percentWidth=100;
currLabel = new Label();
currLabel.text = currValues.name;
currBox.addChild(currLabel);
currBox.addEventListener( MouseEvent.MOUSE_MOVE, beginDrag );
this.addChild(currBox);
}
}

Then this is the function for the child's MouseMove:

public function beginDrag( mouseEvent:MouseEvent ):void
{
if (mouseEvent.buttonDown) {
var dragInitiator:IUIComponent = mouseEvent.currentTarget as 
IUIComponent;
var dragSource:DragSource = new DragSource();

DragManager.doDrag( dragInitiator, dragSource, mouseEvent, null 
);
}
}


--- In flexcoders@yahoogroups.com, droponrcll amyblankens...@... wrote:

 
 
 --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote:
 
  Double check your logic about when you call acceptDragDrop
 
 Also, are you overriding createChildren?  If so, please post your code.





[flexcoders] Odd DragOver Problem

2009-11-10 Thread bgamblin
Say you have an HBox, and inside that HBox you have lots of little child 
HBoxes. Now, you want to rearrange the child HBoxes using drag and drop.  Using 
Flex, it's pretty easy to enable drag/drop support. However, the dragover event 
seems to fire at odd points.

As I drag a child HBox around the main HBox, I sometimes see the invalid drag 
icon, even though it should be valid. If it disallowed dragging one child over 
another, I could understand that. But even that seems random, with some 
portions of the children showing as valid drag targets, and others not. With a 
small number of children, it was odd but not debilitating. With a large number 
of children, it became entirely untenable. If I have ten children, I can't drop 
the items anywhere except the first half of it's width.

Is there another element to this that affects where an object becomes a drop 
target or not? Variable width perhaps? Padding? I'm at a loss.



[flexcoders] Re: Odd DragOver Problem

2009-11-10 Thread bgamblin
Never mind. I figured it out. I totally forgot that for something to be 
droppable, it has to be a visible component. In this case, setting the 
background color to anything at all makes it a droppable target.

Sorry for the interruption.


--- In flexcoders@yahoogroups.com, bgamblin bra...@... wrote:

 Say you have an HBox, and inside that HBox you have lots of little child 
 HBoxes. Now, you want to rearrange the child HBoxes using drag and drop.  
 Using Flex, it's pretty easy to enable drag/drop support. However, the 
 dragover event seems to fire at odd points.
 
 As I drag a child HBox around the main HBox, I sometimes see the invalid drag 
 icon, even though it should be valid. If it disallowed dragging one child 
 over another, I could understand that. But even that seems random, with some 
 portions of the children showing as valid drag targets, and others not. With 
 a small number of children, it was odd but not debilitating. With a large 
 number of children, it became entirely untenable. If I have ten children, I 
 can't drop the items anywhere except the first half of it's width.
 
 Is there another element to this that affects where an object becomes a drop 
 target or not? Variable width perhaps? Padding? I'm at a loss.





[flexcoders] Re: Odd DragOver Problem

2009-11-10 Thread bgamblin
Well, I hate to sound ditzy here, but I didn't actually fix all the problems by 
changing the background color. That fix stabilized the problem, making it so 
that the dead zones no longer seem random. However, it is now a situation where 
there is a definite cutoff about midway through the main HBox. Anything to the 
left of center will create a DragOver event. Anything to the right, won't.

Has anybody seen this issue?

--- In flexcoders@yahoogroups.com, bgamblin bra...@... wrote:

 Never mind. I figured it out. I totally forgot that for something to be 
 droppable, it has to be a visible component. In this case, setting the 
 background color to anything at all makes it a droppable target.
 
 Sorry for the interruption.
 
 
 --- In flexcoders@yahoogroups.com, bgamblin BrandG@ wrote:
 
  Say you have an HBox, and inside that HBox you have lots of little child 
  HBoxes. Now, you want to rearrange the child HBoxes using drag and drop.  
  Using Flex, it's pretty easy to enable drag/drop support. However, the 
  dragover event seems to fire at odd points.
  
  As I drag a child HBox around the main HBox, I sometimes see the invalid 
  drag icon, even though it should be valid. If it disallowed dragging one 
  child over another, I could understand that. But even that seems random, 
  with some portions of the children showing as valid drag targets, and 
  others not. With a small number of children, it was odd but not 
  debilitating. With a large number of children, it became entirely 
  untenable. If I have ten children, I can't drop the items anywhere except 
  the first half of it's width.
  
  Is there another element to this that affects where an object becomes a 
  drop target or not? Variable width perhaps? Padding? I'm at a loss.
 





[flexcoders] JavaScript can't call Flex

2009-09-24 Thread bgamblin
I've got a SWF, embedded in an object, just like the standard Flex HTML. In 
another section of the same HTML, I have JavaScript that calls a function in 
the SWF. However, when the call is made, everything stops. That is to say, all 
code written after that call is ignored, and the function itself doesn't 
execute.

// In the HTML
function JavaCall()
{
   getFlexApp('SWFName').callFlexFunc();
}

function getFlexApp(appName) 
{
   if (navigator.appName.indexOf (Microsoft) !=-1)  return window[appName];
   else return document[appName]; 
}


// inside app creation function
ExternalInterface.addCallback(callFlexFunc, calledFunc);

// outside creation function
public function calledFunc(event:Event = null):void
{
   // Execution doesn't get this far
}

I should note that the object and embed that hold the SWF are set to 
allowScriptAccess=always. It's not something I intend to ship with, but I'm 
grasping at straws at this point.

Every tutorial I've seen on the subject seems to indicate that I'm doing just 
what I should be doing. So I have no idea what could be wrong. Any help would 
be appreciated.

-Brand



[flexcoders] Re: JavaScript can't call Flex

2009-09-24 Thread bgamblin
I appreciate the quick response. Unfortunately, the call comes long after the 
SWF is loaded. 

This is part of my attempt to upload a file using a self signed-SSL connection 
(notoriously difficult in Flex). So this call comes after the backend has 
already loaded the file, and it's just returning a response through the 
JavaScript.

Do you know if there's any way to log this? In case it's calling the function 
but getting an error back?


--- In flexcoders@yahoogroups.com, Paul Andrews p...@... wrote:

 I suspect you're calling the function before the SWF is properly loaded. 
 Get the Flex app to call a javascript function to say when it's ready to 
 run, only then call any functions in the SWF.
 
 Paul
 



[flexcoders] Re: JavaScript can't call Flex

2009-09-24 Thread bgamblin
There are many things that the user has to do to get to the menu where this 
call is made. So, the Flash would have to be ready, or else it wouldn't have 
been responding to state changes, button presses, and all the other things 
necessary to get to that point.

I do know, for instance, that this occurs after the creationComplete event is 
called, and after several interactions with the backend.

I think that, if I could find out what was going on in the JavaScript (by 
getting an error code or determining whether that function was available on 
that object, or something), it would give me a better idea of what I was 
looking at.


--- In flexcoders@yahoogroups.com, Paul Andrews p...@... wrote:

 bgamblin wrote:
  I appreciate the quick response. Unfortunately, the call comes long after 
  the SWF is loaded. 
 
  This is part of my attempt to upload a file using a self signed-SSL 
  connection (notoriously difficult in Flex). So this call comes after the 
  backend has already loaded the file,
 How do you know? Unless you let Flex tell you when it's ready to go, 
 Javascript won't know when enough of the SWF has been loaded.
 
 Paul
 
   and it's just returning a response through the JavaScript.
 
  Do you know if there's any way to log this? In case it's calling the 
  function but getting an error back?
 
 
  --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:

  I suspect you're calling the function before the SWF is properly loaded. 
  Get the Flex app to call a javascript function to say when it's ready to 
  run, only then call any functions in the SWF.
 
  Paul
 
  
 
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Alternative FAQ location: 
  https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
  Search Archives: 
  http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
 
 
 
 
 





[flexcoders] Re: JavaScript can't call Flex

2009-09-24 Thread bgamblin
Ah Ha! Found it. The problem was in my flex code, in the callback. I defined it 
as taking one parameter, an event. Just to make sure that wasn't the problem, I 
put in a default value of null for the parameter, but that's not the same as 
having no parameter at all. So, when JavaScript called it with no parameters, 
Flex didn't recognize the same signature, and stopped (if I could run this 
through the debugger, I probably would have found that).

So, note to self. Setting a default parameter as null is not the same, 
signature-wise, as sending no parameters.

Thanks to Paul Anderson for his help.

-Brand




--- In flexcoders@yahoogroups.com, bgamblin bra...@... wrote:

 There are many things that the user has to do to get to the menu where this 
 call is made. So, the Flash would have to be ready, or else it wouldn't have 
 been responding to state changes, button presses, and all the other things 
 necessary to get to that point.
 
 I do know, for instance, that this occurs after the creationComplete event is 
 called, and after several interactions with the backend.
 
 I think that, if I could find out what was going on in the JavaScript (by 
 getting an error code or determining whether that function was available on 
 that object, or something), it would give me a better idea of what I was 
 looking at.
 
 
 --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
 
  bgamblin wrote:
   I appreciate the quick response. Unfortunately, the call comes long after 
   the SWF is loaded. 
  
   This is part of my attempt to upload a file using a self signed-SSL 
   connection (notoriously difficult in Flex). So this call comes after the 
   backend has already loaded the file,
  How do you know? Unless you let Flex tell you when it's ready to go, 
  Javascript won't know when enough of the SWF has been loaded.
  
  Paul
  
and it's just returning a response through the JavaScript.
  
   Do you know if there's any way to log this? In case it's calling the 
   function but getting an error back?
  
  
   --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
 
   I suspect you're calling the function before the SWF is properly loaded. 
   Get the Flex app to call a javascript function to say when it's ready to 
   run, only then call any functions in the SWF.
  
   Paul
  
   
  
  
  
   
  
   --
   Flexcoders Mailing List
   FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
   Alternative FAQ location: 
   https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
   Search Archives: 
   http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups 
   Links
  
  
  
  
  
 





[flexcoders] ItemRenderer killing datatips in List?

2009-09-16 Thread bgamblin
I've got an object that descends from List, and uses an itemRenderer. Recently, 
I tried adding datatips to it, but nothing shows up. When I set it to use a 
datatipFunction, the function never gets called.

If, however, I remove the itemRenderer, datatips show up properly. Has anybody 
seen this sort of thing before?

(Note: the ItemRenderer creates two objects, but neither one short-circuits 
mouse events or have datatip info of their own)