|
POST
|
Looking at your code, I see that you are adding the printbox to your app at some point. I think the bitmap->png code is firing before the component has had a chance to draw. You can try waiting for the addedToStage event printBox.addEventListener(Event.ADDED_TO_STAGE, printBoxReady);
this.addChild(printBox);
function printBoxReady(e:Event):void
{
// code to turn your printbox into bitmapdata and encode to png
// and initialize your filereference
} At that point, you should be able to see your component, so it is fully drawn and ready. You'll probably want to wait to do this.addChild() until after you have added everything into printbox you want to add.
... View more
05-12-2011
10:14 AM
|
0
|
0
|
2298
|
|
POST
|
I ran into similar problem at some point, which I thought was weird. I ended up just parsing the json result, which is fast and gives me a little freedom to do some other stuff with it as well. https://github.com/odoe/LegendViewer/blob/master/src/net/odoe/flexmaptools/components/helpers/LayerExtractor.as
... View more
05-12-2011
10:04 AM
|
0
|
0
|
1864
|
|
POST
|
It looks like it should work and I just tested the BitmapData to PNG part and it works for me. The only thing I can think of is maybe you need to explicitly set height where you set the width. printBox.width = map.width;
printBox.height = map.height; Since you are creating the printBox in your function, it never actually gets added to the application stage, which is ok. But the events that occur when a Component is added (visually) to an application do the leg work for you of defining the componets width/height based on it's children. In this case, since the component is just used in this function, those lifecycle events never happen, thus printBox.height is proabably null. Explicitly setting it should work... I think 🙂
... View more
05-12-2011
07:39 AM
|
0
|
0
|
2298
|
|
POST
|
It's been a while since I've done this, but you can turn the component to a bitmap something like var bmd:BitmapData = new BitmapData(com.width, comp.height);
bmd.draw(comp, new Matrix());
var bm:Bitmap = new Bitmap(bmd); Then you can use a jpeg encoder to save the bitmapdata to a jpeg file. Flex Framework provides it's own JPEGEncoder mx.graphics.codec.JPEGEncoderYou just pass the BitmapData to the encoder and it does the work. Here is a demo of how to use the jpegencoder to save the image to disc. http://ntt.cc/2009/01/09/as3corelib-tutorialhow-to-use-jpegencoder-and-pngencoder-class-in-flex.html Hope that helps.
... View more
05-12-2011
06:09 AM
|
0
|
0
|
2298
|
|
POST
|
Not sure if it would matter, but can you verify of event.layer.loaded is true before adding it to legend? Not sure what the internals of the ESRI legend look like, but if the layers load event fires after adding it to legend, maybe it's adding it again internally.
... View more
05-11-2011
07:42 AM
|
0
|
0
|
454
|
|
POST
|
I would think it's that Flexviewer provides the basic foundation for an app, so someone can quickly get an app up and running without having to fuss with building out their app structure, event dispatchers, controllers and so on. It's pretty quick to get a widget up and going and drop it into Flexviewer. We have a couple of Flexviewer apps at work which has prompted me to build a few widgets in-house. Mainly, I build apps from scratch though, for various reasons and there are tools/workflows to get up and running such as ANT build/structure scripts, ProjectSprouts, Frameworks, etc. That doesn't mean your widgets need to built in such a way that they have to be tightly coupled to Flexviewer. I've been meaning to write more about this, but I put an example up of a widget where the component itself sits in a completely different package than the widget. http://www.arcgis.com/home/item.html?id=708ae903d3994999a3a861f35bf7408d Basewidget just adds the component and provides the map instance.
protected function basewidget_creationCompleteHandler(event:FlexEvent):void
{
var legend:LegendViewer=new LegendViewer();
legend.percentHeight=100;
legend.percentWidth=100;
legend.map=map;
wTemplate.addElement(legend);
}
The same component can be used in a completely non-Flexviewer app. I've seen a few other widgets built this way as well and I think it's good practice, especially when a Flexviewer update comes out. Then you would not need to modify the component itself in that case. The most you'd have to worry about is if the API requries you to change your component in some way. Now I'm rambling, but in general, I think it comes down to time restraints and manpower.
... View more
05-10-2011
12:33 PM
|
0
|
0
|
554
|
|
POST
|
It depends on what the event listener is acting upon. ItemRenderers are built to work in Lists/DataGrids that will have a collection of objects. The data object is a reference to that particular item that is selected in a List. Now that you have moved it to your main index.mxml file, what is the function acting upon? I see you're using a MouseEvent, so I assume a Button click. Where the email source coming from when you click that button?
... View more
05-05-2011
01:47 PM
|
0
|
0
|
758
|
|
POST
|
You should wrap the collection in a dataprovider and use the fx namespace for object.
<s:ButtonBar>
<s:dataProvider>
<s:ArrayCollection>
<fx:Object />
</s:ArrayCollection>
</s:dataProvider>
</s:ButtonBar>
... View more
05-04-2011
08:44 AM
|
0
|
0
|
513
|
|
POST
|
FB 4.5 has an iOS packager, and I know you can deploy to an iOS device. I have not checked to see how the touchscreen capabilities work with the Flex API though. I would think that would be my main area of concern.
... View more
05-04-2011
07:57 AM
|
0
|
0
|
1364
|
|
POST
|
You shouldn't need to do anything in your properties in FlashBuilder. Just delete the swc in the libs folder and add the new one. FlashBuilder by default will look for swc files in the {project}/libs folder. So, if you delete the folder in your "Flex Build Path" properties, go back to it, click on "Add SWC Folder", just type in libs (it will know to look in your project directory) and make sure you have the correct swc in the libs folder. If you added a swc manually in the properties area via the Add SWC..., delete it in the properties. This will get you back where you started.
... View more
04-26-2011
02:49 PM
|
0
|
0
|
455
|
|
POST
|
Ok, I should kick myself. this line... qf.SubFields = "AIN"; needs to change to qf.SubFields = "*"; Apparently, by explicitly defining the returned fields in the queryfilter, if you leave out Shape and OID, they will not be returned either. That's why IFeature.Shape failed, the Shape field was not included in my query. I just assumed Shape would be a default field regardless of what I specified. Ok, that was quite a learning experience. Thanks for looking.
... View more
04-21-2011
02:22 PM
|
0
|
0
|
986
|
|
POST
|
I don't usually need to deal with geometries too often in ArcObjects, but this is giving me quite a hard time. I can get a IFeature object from my SDE. I can access the attributes fields just fine and pass them as needed. The problem is, when I try to access the IFeature.Shape property, I get the following error. Error HRESULT E_FAIL has been returned from a call to a COM component. stacktrace at ESRI.ArcGIS.Geodatabase.IFeature.get_Shape() This is a code snippet below.
Type sde_type = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory");
//IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)new SdeWorkspaceFactoryClass();
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(sde_type);
IWorkspace workSpace = workspaceFactory.Open(propertySet, 0);
IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workSpace;
#endregion
IFeatureClass featureClass = featureWorkspace.OpenFeatureClass("sde.LA_Parcels");
// prepare the query filter
IQueryFilter qf = new QueryFilterClass();
qf.SubFields = "AIN";
qf.WhereClause = "AIN = '" + ain + "'";
IFeatureCursor fc = featureClass.Search(qf, true);
IFeature feat = fc.NextFeature();
string s_ain = "NOT FOUND";
if (feat != null)
{
int field = feat.Fields.FindField("AIN");
s_ain = feat.get_Value(field) as string;
// grab some more field data ...
IGeometry fgeom = null;
try
{
fgeom = feat.Shape; // error gets thrown here
}
catch (Exception e)
{
throw new Exception(String.Format("ParcelLocationData Geometry from Shape Error: {0}", e.Message), e);
}
}
I had read on a blog that it was good practice when creating ArcObjects objects on server to not use "new", but use Activator.CreateInstance, so I switched that up as it came up in my search on the COM error, but still nothing works. I can view this data in ArcMap just fine, it works on MapServices that we have. I have other C# dll's using ArcObjects running on this server just fine for sewer tracing, none of which actually access the IFeature.Shape property though. Is there a step I am missing to try and do this? My goal here is to use the IFeature.Shape as a basis for some spatial queries on other features. Something like this IArea area = (IArea)fgeom;
spatialFilter.Geometry = area.Centroid Thanks in advance, and I'm sorry if this is something simple I am missing.
... View more
04-21-2011
01:05 PM
|
0
|
2
|
1410
|
|
POST
|
Scratch this. I think it has to do with SVN failing to delete 2.2 from a library project. 2.2 refs still floating around. Can verify Monday. Thanks. My bad.
... View more
04-15-2011
02:50 PM
|
0
|
0
|
776
|
|
POST
|
Bjorn, the what's new states that InfoWindow has been moved from com.esri.ags.components.supportClasses. I think it now sits in com.esri.ags.components, is that correct? My InfoWindows seems to be all broken now when I use my own InfoWindowRender. Should I just make a new thread?
... View more
04-15-2011
12:24 PM
|
0
|
0
|
1323
|
|
POST
|
In a situation like that, you'd probably want to wrap that whole function into it's own class that extends EventDispatcher, then have the function dispatch the result "name". You could make a custom event or use a DynamicEvent to save some time.
... View more
04-13-2011
07:53 PM
|
0
|
0
|
663
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 2 | 3 weeks ago | |
| 1 | 02-27-2026 06:31 AM | |
| 1 | 01-13-2026 02:15 PM | |
| 1 | 12-31-2025 09:05 AM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|