Hang Calling function after Document Class' Event.ADDED
I was trying to load an external SWF (that contains the below code in its document class) with the Loader class but i keep on receiving Error #1009: Cannot access a property or method of a null object reference. So i tried to use the event listener Event.ADDED in MyDocumentClass constructor of the external SWF to let the document class be part of the display list before i invoke createRandomGraph. But when i place createRandomGraph( ) inside onStageReady, The compilation process hangs. When i leave the createRandomGraph( ) inside the constructor, it works perfectly as stand alone but will produce Error 1009 if loaded within the loader SWF. Any ideas?
public function MyDocumentClass( )
this.addEventListener(Event.ADDED, onStageReady);
createRandomGraph( )
private function onStageReady(oEvent:Event):void
this.removeEventListener(Event.ADDED, onStageReady);
private function createRandomGraph( ):void
var cRandomGraph:RandomGraph = new RandomGraph();
cRandomGraph.x = 10;
cRandomGraph.y = stage.stageHeight - nH - 25;
cRandomGraph.setDimensions(nW,nH);
cRandomGraph.createGraphBackground();
this.addChild(cRandomGraph);
use:
public function MyDocumentClass( )
this.addEventListener(Event.ADDED_TO_STAGE, onStageReady);
private function onStageReady(oEvent:Event):void
this.removeEventListener(Event.ADDED, onStageReady);
createRandomGraph();
private function createRandomGraph( ):void
var cRandomGraph:RandomGraph = new RandomGraph();
cRandomGraph.x = 10;
cRandomGraph.y = stage.stageHeight - nH - 25;
cRandomGraph.setDimensions(nW,nH);
cRandomGraph.createGraphBackground();
this.addChild(cRandomGraph);
Similar Messages
-
Call function inside running class
Hey All,
i have a two question in classes.
1- i have class and i called its before and its running on runtime. i need to call function inside this class from another class, but without call the first one again, because if i called it, it will run default class function again
is this doable ?
2- What super() mean ?
Thanks a lot.this is the default call, and when i call the method by this way its will run the default class function before call the method.
here my example:
i need to call checkboxes function in ChannelsMain class without pass by the grey script.
Note: the call_cb is working and the trace is working
so i now the class is running, i need to call the checkboxes without ( var ci:YourClass = new YourClass(); )
package com.link
import fl.controls.CheckBox;
import flash.events.*;
public class ChannelsMain
var cbLength:uint = Main.PV.channel_id.length;
public function ChannelsMain()
// constructor code
for (var i:int = 0; i < cbLength; i++)
var cb:CheckBox = new CheckBox;
cb.name = Main.PV.channel_id[i];
cb.label = Main.PV.channel_name[i];
cb.x = 50;
cb.y = 50 + i * 30;
cb.addEventListener(Event.CHANGE,call_cb);
Main.MS.addChild(cb);
//call xml function
if(i == cbLength - 1)
new ChannelsXML();
private function call_cb(evt:Event)
trace(evt.currentTarget.name,evt.currentTarget.selected);
public function checkboxes(evt)
trace(evt); -
User Exit with call up after document splitting in New GL.
Hello,
I am looking for a user exit which is called up after document splitting and before final posting to FI. We are implementing Ecc 6.0 and wish to change functional area on gl line item based on values in cost center. However, this change/redetermination of functional area also needs to be done on documents which have been split. Splitting is at profit center level.
Regards
Jayesh.Hi Gordon,
Yes, by a little piece of ABAP.
I have created a Z table and configured by co.code and document type. Add a little bit of code in the badi FAGL_3KEH_DEFPRCTR.
Hope it helps.
Thanks,
Srini -
Execute functions in document class when main timeline reaches a frame
Hi,
I have 3 functions in my main document class that I want to execute when the main timeline reaches a particular frame number.
how do I do that?
see the code and comments
public function mainClass()
//stage declaraction
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, stageResized);
//wrap these next 3 lines in an if statement that says if maintimeline currentframe = x
position();
loadXml();
initArrowButtons();
slideTimer = new Timer(timer_delay);
slideTimer.addEventListener(TimerEvent.TIMER, nextSlide);It's still undocumented, but something like this would do it:
package
import flash.display.MovieClip;
public class FrameScript extends MovieClip
public function FrameScript()
addFrameScript( 3, frameFour );
private function frameFour():void
trace( "you have reached Frame 4" );
You can test this as a documentclass. -
Call function after AutoSuggest select
Hello,
Looking at the
Auto-suggest
Overview I'm wondering if any clever folks out there can tell
me the best way to call a function after a user has selected an
item from the list (preferably by either mouse or keyboard). The
function takes the selected value as an argument.
On a related note does anyone think that
Spry.Widget.AutoSuggest would benefit from a finish option like the
apry effects have?
Cheers,
PeterHi Cristian,
Thanks for your reply.
Firstly, I forgot to say in my previous post how great I
think Spry is, I've played with some other frameworks in the past
but Spry is the one that has really clicked with me.
The future developments look very interesting, I'll be
keeping my eye on Spry.
As for the what I mean by the finish: callback function, it
occurs to me that many people may want to have spry do 'x' after
the user has selected something from the AutoSuggest list. In my
case I want to filter a recordset based on what the user has just
selected, this can be done easily by having them click a button
that calls a function after they have made their selection but
having the option of this happening 'automatically' would be a real
boon.
I don't really know anything about advanced JS so I don't
know if something like this would be possible. E.g.:
var ac6 = new Spry.Widget.AutoSuggest("productSampleDiv",
"productMenuDiv", "dsProducts3", 'name', {containsString: true,
minCharsType: 2, finish: function x() }); -
Calling function from deferint classes
Dear all
Am working in multiple classes application and i need to use from another class how i can
Do that like :
Function name sendBye in class SipMessage and i need to use that function in class callBox
I try to use this code
SipMessage sipM = new SipMessage();{
sipM.callBox; but am receiving many ExceptionsJavarcle wrote:
but am receiving many ExceptionsThat sucks, dude. Maybe if you fix the problem, you'll stop getting the exceptions -
ADDED event in document class after removed from Stage
Hi All,
I am currently play with the document class (the class acts as main) constructor for a SWF file.
package {
import flash.display.*;
import flash.events.*;
public class TestSymbol extends MovieClip
public function TestSymbol()
this.addEventListener(Event.ADDED, function(event:Event) { trace(event.eventPhase, event.target, event.currentTarget, "added triggered"); });
trace("parent", this.parent);
this.stage.removeChild(this);
trace("stage", this.stage);
In frame script 1, i put
trace("1");
trace("parent", this.parent);
After i run TestSymbol.swf and i got
parent [object Stage]
stage null
2 [object TestSymbol] [object TestSymbol] added triggered
1
parent null
I wonder where is this ADDED event coming from? If the document class is added to some other objects, why its parent is null after the event?
Thanks in advance
SamBy wrapper do you mean they are the same object or the MainTimeLine is a separate object being added to DocumentClass, as it triggers the ADDED event? I know that framescript can be accessed as documentClass functions, so I thought they are the same object, maybe i was wrong.
I did a new test within some more listeners
package {
import flash.display.*;
import flash.events.*;
public class TestSymbol extends MovieClip
public function TestSymbol()
this.addEventListener(Event.ADDED_TO_STAGE, addedToStageListener);
this.addEventListener(Event.ADDED, addedListener)
this.addEventListener(Event.REMOVED_FROM_STAGE, removedFromStageListener);
this.addEventListener(Event.REMOVED, removedListener);
trace("parent", this.parent);
this.stage.removeChild(this);
trace("stage", this.stage);
private function addedListener(event:Event):void {
trace(event.eventPhase, event.target, event.currentTarget, "added triggered");
private function addedToStageListener(event:Event):void {
trace(event.eventPhase, event.target, event.currentTarget, "addedToStage triggered");
private function removedListener(event:Event):void {
trace(event.eventPhase, event.target, event.currentTarget, "removed triggered");
private function removedFromStageListener(event:Event):void {
trace(event.eventPhase, event.target, event.currentTarget, "removedFromStage triggered");
and this is the output
parent [object Stage]
2 [object TestSymbol] [object TestSymbol] removed triggered
2 [object TestSymbol] [object TestSymbol] removedFromStage triggered
stage null
2 [object TestSymbol] [object TestSymbol] added triggered
As the remove listeners are fired immediately, i don't think the queue is waiting until the end of the constructor. -
Calling a function inside another class
I have the following two classes and can't seem to figure to figure out how to call a function in the top one from the bottom one. The top one get instantiated on the root timeline. The bottom one gets instantiated from the top one. How do I call functions between the classes. Also, what if I had another call instantiated in top one and wanted to call a function in the bottom class from the second class?
Thanks a lot for any help!!!
package
import flash.display.MovieClip;
public class ThumbGridMain extends MovieClip
private var grid:CreateGrid;
public function ThumbGridMain():void
grid = new CreateGrid();
public function testFunc():void
trace("testFunc was called");
package
import flash.display.MovieClip;
public class CreateGrid extends MovieClip
public function CreateGrid():void
parent.testFunc();kglad,
Although I agree that utilizing events the way you attempted in your suggestion is better for at least a reason of eliminating dependency on parent, still you code doesn't not accomplish what Brian needs.
Merely adding event listener to grid instance does nothing - there is no mechanism in the code that invokes callTGMFunction - thus event will not be dispatched. So, either callTGMFunction should be called on the instance (why use events - not direct call - in this case?), or grid instance needs to dispatch this event based on some internal logic ofCreateGrid AFTER it is instantiated - perhaps when it is either added to stage or added to display list via Event.ADDED. Without such a mechanism, how is it a superior correct way OOP?
Also, in your code in ThumbGridMain class testFunc is missing parameter that it expects - Event.
Am I missing something?
I guess the code may be (it still looks more cumbersome and less elegant than direct function call):
package
import flash.display.MovieClip;
import flash.events.Event;
public class ThumbGridMain extends MovieClip
private var grid:CreateGrid;
public function ThumbGridMain():void
grid = new CreateGrid();
grid.addEventListener("callTGMFunction", testFunc);
addChild(grid);
// to call a CreateGrid function named cgFunction()
public function callCG(){
grid.cgFunction();
public function testFunc(e:Event):void
trace("testFunc was called");
package
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.Event;
public class CreateGrid extends MovieClip
public function CreateGrid():void
if (stage) init();
else addEventListener(Event.ADDED, callTGMFunction);
// to call a TGM function
public function callTGMFunction(e:Event = null):void
// I forgot this one
removeEventListener(Event.ADDED, callTGMFunction);
this.dispatchEvent(new Event("callTGMFunction"));
public function cgFunction(){
trace("cg function called");
I think this is a case of personal preference.
With that said, it is definitely better if instance doesn't rely on the object it is instnatiated by - so, in this case, either parent should listen to event or call a function directly. -
Call function or class from a loaded MC
Hi,
Can anyone tell me if its possible to call a function or class from within a loaded MC?
mainMovie loads MC > MC calls function in a class of mainMovie
if so, what is the best method?
I've tried this from loaded MC but (of course) an error pops:
movieClip(parent.parent).DO_THIS();
Thanks for any "light" on this.It works fine!
I'll try now to "sniff" into some class in main movieClip...
Thanks -
How to initialize a function in another class
Hello,
I have one class 'run.as'
In this class i add an movieclip to the stage with it's own
class.
So in the constructor of run.as i have:
_ElevatorDoors = new ElevatorDoors (200,200);
_ElevatorDoors .name ="liftdeuren";
addChild(_ElevatorDoors );
Oke, that works.. the doors appear on the stage.
In this run.as i also have a function that will open these
doors.
_ElevatorDoors.OpenCloseDoors();
This is a function in the ElevatorDoors class. In this class
i have an motionTween.
And when the tween is finished i want to initialize a
function in the run.as
I don't know how to do that. I know if you extend the run.as
class you could use super. and then the function.
But the ElevatorDoors class has been extended to the
MovieClip.
Does anyone has a suggestion how to do this?
Thanks in advance.I have 3 classes:
run.as (main class)
elevatorDoors.as (extends MovieClip)
elevator.as (extends MovieClip)
In the run.as i added the 2 classes (elevatorDoors.as and
elevator) with addChild..
From the run.as i can call functions from these classes.
But when i want to call a function from the elevatorDoors.as
to it's main class it works.
And in the mainclass (run.as) i call a function in the
elevator.as class.
Altough i can call the function trough the mainclass i can't
set the properties of the elevator.as movieclip.
I don't know how to set it's properties. -
CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
I am newbie to ABAP.
To get the characteristic values I am using following FM inside a BADI called Batch_Master.
When I test this FM in se37 I get the desired values in t_class with one entry and t_objectdata with 4 entries.
I know what to fill in for class, classtype, object.
<b>Now when I call this FM in BADI how do I read my data from t_class and t_objectdata ??</b>
CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
EXPORTING
class = i_class
classtype = i_classtype
object = i_objek
TABLES
t_class =
t_objectdata =
*EXCEPTIONS
*no_classification = 1
*no_classtypes = 2
*invalid_class_type = 3
*OTHERS = 4This is the sample code
FORM voorraden_in_output TABLES xmchb STRUCTURE wa_xmchb
CHANGING wa_vart04_charg
STRUCTURE wa_vart04_charg.
SORT xmchb BY werks lgort matnr.
* charge tabel lezen
LOOP AT xmchb INTO wa_xmchb WHERE matnr = wa_vart04_charg-matnr.
l_wa_mchb = wa_xmchb.
wa_vart04_charg-werks = l_wa_mchb-werks.
* magazijn
wa_vart04_charg-lgort = l_wa_mchb-lgort.
* charge
wa_vart04_charg-charge = wa_xmchb-charg. "LCMG PD 20070712
* bepaal batchclassificatie
PERFORM clear_class_fields CHANGING wa_vart04_charg.
IF NOT wa_xmchb-charg IS INITIAL. "LCMG PD 20070712
PERFORM get_classificatie_batch TABLES ta_object_data
USING wa_vart04_charg-matnr
wa_vart04_charg-charge.
* vul wa_vart04_charg met gegevens uit ta_object_data
PERFORM kenmerken_in_output TABLES ta_object_data
ta_class
USING wa_vart04_charg
wa_xmchb. "LCMG PD 20070712
ENDIF.
PERFORM check_kenmerken USING wa_vart04_charg
CHANGING sy-subrc.
IF sy-subrc <> 0.
CHECK 1 = 2.
ENDIF.
* gereserveerde voorraad bepalen
PERFORM gereserveerde_voorraad CHANGING l_wa_mchb
wa_vart04_charg.
* voorraden charge regel bepalen
PERFORM charge_voorraden USING l_wa_mchb
wa_vart04_charg.
* charge regel is volledig bepaald
APPEND wa_vart04_charg TO ta_vart04_charg.
ENDLOOP.
ENDFORM.
* lokale data vullen
l_object(18) = artikel.
l_object+18(10) = charg.
l_classtype = c_023.
l_obtab = 'MCH1'.
FORM get_classificatie_batch TABLES ta_object_data STRUCTURE clobjdat
USING artikel TYPE mara-matnr
charg TYPE mchb-charg.
DATA: l_object TYPE ausp-objek,
l_classtype TYPE klah-klart,
l_obtab TYPE tcla-obtab.
* lokale data vullen
l_object(18) = artikel.
l_object+18(10) = charg.
l_classtype = c_023.
l_obtab = 'MCH1'.
* schonen interne classificatie tabellen
* REFRESH: ta_class, ta_object_data. "LCMG PD 20070712
CLEAR : ta_class, ta_object_data.
CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
EXPORTING
classtype = l_classtype
language = sy-langu
object = l_object
objecttable = l_obtab
key_date = sy-datum
no_value_descript = 'X' " 467394GVE
initial_charact = ' '
TABLES
t_class = ta_class
t_objectdata = ta_object_data
EXCEPTIONS
no_classification = 1
no_classtypes = 2
invalid_class_type = 3
OTHERS = 4.
ENDFORM. -
Server side function not get called after dispatching cairngorm event second time on same page
Hi All,
I am facing a urgent issue regarding cairngorm event. Actually my page contain 3 button add,delete,save
and clicking of any button I do the respected functionality. For ex:
I click the add button & on clicking of add button I fire a cairngorm evnt & after getting response from server side that the record is added
I displayed a message that the record is added & update the data source.
After addition of the record , with out going to other page if I perform the same functionaly(Like adding another record) on same page the cairngorm
event not call the server side function - after debugging I find out that cairngorm event reach to the corresponding excutecommand function & called that function but it is not calling my server side function & I also din't get any error message .
I dont know why the server side function not get called?. similarly if I try for delete or update case the same things happend. Only for the first time it works properly but not for the second time.
Could any of you please tell me why the cairngorm event not calling the server side function.
Thank you for your kind assistance.
Regards,
UjjwalOkay, well I think I've worked out the problem.
In ASP.NET we would typically bind repeating controls such as DataLists and Repeaters manually using <i>Control</i>.DataBind(), because we're usually using a separate class library containing collections for our objects. Seems the SAP Table control doesn't like this approach.
I changed the code so that the databinding is specified on the control, and call the Page's DataBind() method and it all worked fine.
One tip: because the collection I used to bind to is in a separate class library, I receieved a <i>BC306523: Reference required to assembly MyAssemblyName...</i> message, even though I had a reference to the assembly in my project and the DLL is being properly deployed. To fix this, you must include the following directive at the top of the component's ASCX file:
<%@ Assembly Name="AssemblyName" %> -
Event to handle DocNo. automatic population after document was added
Hi,
I have created a UDF using SAP B1 Studio with visual studio 2010.Values can enter in form and it is successfully added to table. I am trying to show the DocumentNo. automatically once document got added to the table.
i.e., DocNo. textbox in form is empty once document got added.I have tried in Buttonclick after,Data Add after...Its not working.
In which event can we handle this?
Thanks in Advance,
Parvatha Solai.NHi Parvatha,
The DocNumber is finalised by SAP when you save the document.
Hence, you cannot save this number into your UDF at the same time.
This has to be a two step process.
On After Data Add event,
1 get the DocEntry from the pVal.ObjectKey
2 Call up the Doc using this object key and update your UDF
Dim oDoc As SAPBobsCOM.Documents = oCompany.GetBusinessObject(yourDocObjType)
oDoc.GetByKey(DocEntry)
oDoc.UserFields.Fields.Item("UDF").Value = oDoc.DocNum
oDoc.Update
On the other hand, why would you want to save the docnum in the user field ?
Regards
Edy -
Accessing document class function within timeline
Hi have a very simple question,
(Bear with me I'm still quite new to as3 and some of my terminology may not be solid)
I want to access a function that is within my document class when a movie clip on the timeline has played to a specific point (being the end).
I have already been able to call another function from the document class at the top/root level (it is called to initialize all clips and buttons when you click on the "enter" button on the splash screen.
Problem is that I cannot call another function (in the document class) from a movie clip within a movie clip on the timeline. Is there an easy way to do this? I have considered writing a separate class for the movie clip and then adding it onto the movie clip (using the property panel). I don't really want to do it this way because I am already using a base class on that movie clip and 3 others that use a set of generic functions.>>I want to access a function that is within my document class when a movie clip on the timeline has played to a specific point (being the end).
Your document class should add a listener to the clip and the clip should dispatch an event when it's complete. You could dispatch your own event or use one of Flash's like Event.COMPLETE. Something like:
in clip
dispatchEvent(new Event(Event.COMPLETE));
and in your doc class
clipOnTimeline.addEventListener(Event.COMPLETE, classMethod);
>>I have already been able to call another function from the document class at the top/root level (it is called to initialize all clips and buttons when you click on the "enter" button on the splash screen.
You really should avoid mixing timeline and document class code. Better would be for your doc class to add a listener to the button and call a method within the class when it's clicked. -
How to call a javascript method after the PPR event has finished ?
Hi!
How can we make a javascript method get called after the processing of ADF PPR event?
My specific use case is,
I want to call a javascript function after the data in the table is loaded...
In 10g, that is not a problem, as the data used to get loaded directly during onLoad, and so i would call my js function on load;
but in 11g , the table data is being loaded through PPR which is initiated onload, and so i needed to call my function after the PPR Response processing has been done; for which I need the name of the event triggered at that instance.
Is it possible to do this?
Regards,
SambaHey, I got it.
I handled the ADF Controller's PREPARE_RENDER_ID phase of the lifecycle, and then called the
script to get Executed.
The code :
public void afterPhase(PagePhaseEvent pagePhaseEvent) {
FacesPageLifecycleContext ctx = (FacesPageLifecycleContext)pagePhaseEvent.getLifecycleContext();
if (pagePhaseEvent.getPhaseId() == Lifecycle.PREPARE_RENDER_ID) {
if(AdfFacesContext.getCurrentInstance().isPostback() )
afterRender();
}is written in lifecycle listener , and my backing bean extended this listener ,
and in the afterRender() method I did this :
public void afterRender(){
System.out.println("AFTER RENDER CALLED");
FacesContext context = FacesContext.getCurrentInstance();
ExtendedRenderKitService service = (ExtendedRenderKitService)Service.getRenderKitService(context, ExtendedRenderKitService.class);
service.addScript(context, "translate();");
}That's it.
It did work, magnificently.
Thanks for the idea.
Regards,
Samba
Maybe you are looking for
-
To someone who knows planned delivery cost very well: I have 3 points. 1. Planned delivery cost(in PO), but like to pay other vendor(in MIRO). How? 2. Condition type for Planned delivery cost, like FRA1, FRB1,ect, have Acc. key& Accrual key like FRE,
-
Notification from iCloud?
I just received an email from iCloud that says I have to update my account info. It wants all of my secure info. Is this legit or a scam?? Wondering if others got this email.
-
Action Condition by Sales Org / Dist Channel for Opportunity Management
Hi, i need to set action condition by Sales Org / Dist Channel for Opportunity. i tried using object BUS2000111 but can't find any parameter referring to Sales Org/Dist Channel. any lead really appreciated. JD
-
Hi Experts, I am making an report for my customer with shipment details of the AR delivery. Now i want the export of the shipment details in 4 records, but only get the exported data in 1 line. Is there a way to change the format in excel advanced re
-
Can't add additional Google Calendars
On all my other devices running iOS 5.1, I can see all the other calendars associated with my Google account. (I have it set up as an Exchange account), however on the new iPad (iPad 3), all that is being pulled in is the main Google calendar. None o