Designer (or Viewer) as Module / Flex warnings

Stimulsoft Reports.Flex discussion
Locked
mjb001
Posts: 2
Joined: Fri Nov 25, 2011 7:39 am
Location: Österreich

Designer (or Viewer) as Module / Flex warnings

Post by mjb001 »

Hi,
we just tried to put the designer or viewer in a Flex module for optimizing the loading and the memory usage with this code in the main application:
import mx.core.IFlexDisplayObject;
import mx.core.IVisualElement;
import mx.events.ModuleEvent;
import mx.modules.IModuleInfo;
import mx.modules.ModuleManager;
import mx.messaging.messages.*;

import test.Itestreport;

private var reporter:IModuleInfo;
[Bindable]
private var reporterinstance:Itestreport;

protected function loadreport():void {
reporter = ModuleManager.getModule("test/testreport.swf");
reporter.addEventListener(ModuleEvent.READY, modEventHandler);
reporter.load();
}

private function modEventHandler(e:ModuleEvent):void {
// Add an instance of the module's class to the
// display list.
reporterinstance = reporter.factory.create() as Itestreport;
testvg.addElement(reporterinstance as IVisualElement);
}

private function runreport():void {
reporterinstance.design();
}
The module is simple:
import stimulsoft.report.StiReport;
import stimulsoft.report.design.StiDesignerFx;

private function init():void {
StiDesignerFx.initialize();
}

public function design():void {
var report: StiReport = new StiReport();
report.design();
}
All works, but we get a debug warning:
warning: The class mx.messaging.config.ConfigMap has been used in a call to net.registerClassAlias() in _testreport_FlexInit. This will cause test:testreport to be leaked. To resolve the leak, define mx.messaging.config.ConfigMap in the top-level application.
warning: The class mx.messaging.messages.AcknowledgeMessage has been used in a call to net.registerClassAlias() in _testreport_FlexInit. This will cause test:testreport to be leaked. To resolve the leak, define mx.messaging.messages.AcknowledgeMessage in the top-level application.
warning: The class mx.messaging.messages.AcknowledgeMessageExt has been used in a call to net.registerClassAlias() in _testreport_FlexInit. This will cause test:testreport to be leaked. To resolve the leak, define mx.messaging.messages.AcknowledgeMessageExt in the top-level application.
warning: The class mx.messaging.messages.AsyncMessage has been used in a call to net.registerClassAlias() in _testreport_FlexInit. This will cause test:testreport to be leaked. To resolve the leak, define mx.messaging.messages.AsyncMessage in the top-level application.
warning: The class mx.messaging.messages.AsyncMessageExt has been used in a call to net.registerClassAlias() in _testreport_FlexInit. This will cause test:testreport to be leaked. To resolve the leak, define mx.messaging.messages.AsyncMessageExt in the top-level application.
warning: The class mx.messaging.messages.CommandMessage has been used in a call to net.registerClassAlias() in _testreport_FlexInit. This will cause test:testreport to be leaked. To resolve the leak, define mx.messaging.messages.CommandMessage in the top-level application.
warning: The class mx.messaging.messages.CommandMessageExt has been used in a call to net.registerClassAlias() in _testreport_FlexInit. This will cause test:testreport to be leaked. To resolve the leak, define mx.messaging.messages.CommandMessageExt in the top-level application.
warning: The class mx.messaging.messages.ErrorMessage has been used in a call to net.registerClassAlias() in _testreport_FlexInit. This will cause test:testreport to be leaked. To resolve the leak, define mx.messaging.messages.ErrorMessage in the top-level application.
warning: The class mx.messaging.messages.HTTPRequestMessage has been used in a call to net.registerClassAlias() in _testreport_FlexInit. This will cause test:testreport to be leaked. To resolve the leak, define mx.messaging.messages.HTTPRequestMessage in the top-level application.
warning: The class mx.messaging.messages.MessagePerformanceInfo has been used in a call to net.registerClassAlias() in _testreport_FlexInit. This will cause test:testreport to be leaked. To resolve the leak, define mx.messaging.messages.MessagePerformanceInfo in the top-level application.
If we put the initialize code in the main application, no warnings appear, but we have the full package size in the main application, what we want to prevent.

My question:

- Can we ignore this? I don't think so ...
- Can we make a workaround without packing the full code in the main application?

Martin
mjb001
Posts: 2
Joined: Fri Nov 25, 2011 7:39 am
Location: Österreich

Designer (or Viewer) as Module / Flex warnings

Post by mjb001 »

Hi,
an update ... this would help to prevent the error in the main app, but is this clean??
import mx.messaging.messages.*;
private var _dummy01:ConfigMap;
private var _dummy02:AcknowledgeMessage;
private var _dummy03:AcknowledgeMessageExt;
private var _dummy04:AsyncMessage;
private var _dummy05:AsyncMessageExt;
private var _dummy06:CommandMessage;
private var _dummy07:CommandMessageExt;
private var _dummy08:ErrorMessage;
private var _dummy09:HTTPRequestMessage;
private var _dummy10:MessagePerformanceInfo;
Martin
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Designer (or Viewer) as Module / Flex warnings

Post by Vladimir »

Hello,

Most likely, your way is correct, because the Flex compiler does not include SDK classes in the assembly, which are not used in the main module. But if they are used in additional modules, the compiler displays a warning.

Thank you.
Locked