Actionscript 3 :: Error When Calling A Function From Main In Flex?
Oct 12, 2011i am trying to call a function which is defined in main.mxml
public function btnAcceptCall_clickHandler(event:MouseEvent)
[Code]...
i am trying to call a function which is defined in main.mxml
public function btnAcceptCall_clickHandler(event:MouseEvent)
[Code]...
In my main application I have a viewstack with 3 child views. In the viewstack change handler, I programmatically change the selectedchild property.
I understand that the initialize method for the view is not called every time I change the selectedChild Property. So I tried to invoke the init method programmatically too..
view1.mxml
<fx:Script>
<![CDATA[
[Code].....
I have a buttons class I would like to access but not sure of proceedure. Here is the Main.as
and here is the button class
this is actions layer:
I decided to rewrite my question from an earlier post...I'm using the TextMetric class: URL...The code below currently resides on the attachedMC timeline, and is written twice with different variables for each time called for each dynamicText.[code]What i am trying to do (emphasis on trying) is write the code on the main timeline, so that it can be called from any attached MC, a sort of global function if you will. Another thing to note is that there are multiple dynamic Texts using the function at the same time.[code]
View 4 RepliesI can't seem to access functions (methods) of my document class from any other class in the same package. What i need to do is create some global functions like menu reset, title change, etc. Maybe i'm not fully understanding the OOP concept, because this seems simple and it should totally work, but it doesn't and no documentation has been able to tell me why.
I have a document class called Main.as like this:
Code:
package
{
import flash.display.Sprite;
[Code]...
I have a project which requires the loading and unloading of multiple "scenes". All my navigation is working (probably not the most efficient way) but I'm having one issue. I need a button on one of the loaded SWFs to call a function on the main timeline. Since Actionscript 3 no longer supports the _root functionality the way AS2 did, I cannot access the main timeline.
In general, how do I get to the root of the main timeline without using _root?
Also, how can I reference the loaded SWF and objects inside of it from the main timeline?
I've written a script that takes keyboard input to turn movieclips on and off in a swf file (like the visible/invisible layer function in photoshop). Then I'm attempting to load the *.swf (image.swf) into a zoom/pan flash file from flash den. When I load it in, the keyboard controls no longer work. I've tried importing the keyboard control function (keyDownListener) into the main zoom.fla with this script:
Code:
import flash.display.Loader;
import flash.net.URLRequest;
[code].....
I want to make 5 buttons visible after a logo has animatedI have a function called vis that successfully makes the buttons visible.How do I call this from within the movie clip (instance name 'logo'?)first frame of main timeline code:
stop();
function vis () {
webMC.visible = true;
[code].....
So this was quite simple in AS2, but considering that _root is no longer around, how can I call a function that is on the main time line from a nested movie clip?
This is what I have inside my movie clip:
Code: this.hit_mc.addEventListener(MouseEvent.CLICK, updateScore); I tried using Stage.updateScore, but that didn't work either. This is the error I'm getting:
1119: Access of possibly undefined property Stage through a reference with static type flash.display:Stage.
i am getting a "ReferenceError: Error #1069: Property beginTargetLock not found on AimCursor and there is no default value."
[Code].....
I have a set function
public function set energy(value:int):void
when I try to call this function from the same class using
energy(10); or this.energy(10)
I get an error:
Call to a possibly undefined method energy.
There are no variables declared as energy in the class.
I have never encountered this problem before.
I have a support class called ICSNAArrays.
It contains only static functions.
In my main class file I have imported it and then when I try to call one of the functions I get a compiler error that says there is no method with the name 'ICSNAArrays' I don't understand this. There are no errors importing it. All of the spelling is correct I am 100% sure on that. [url]...
I have a class called S3Uploader which extends Sprite, which has a private function init, which looks sometihng like this:
private function init(signatureUrl:String,
prefixPath:String,
fileSizeLimit:Number,[code].....
however, on the line where i call s3upload.init, i get a 1195 error saying "1195: Attempted access of inaccessible method init through a reference with static type S3Uploader."When i looked up this error, it seems like almost everyone getting this was trying to call a function with set or get. However, I am not doing this and i have no idea why i am getting this error.
I have a support class called ICSNAArrays. It contains only static functions. In my main class file I have imported it and then when I try to call one of the functions I get a compiler error that says there is no method with the name 'ICSNAArrays' I don't understand this. There are no errors importing it. All of the spelling is correct I am 100% sure on that.
View 9 RepliesI'm having a hard time because of an "Error #1009:Cannot access a property or method of a null object reference" Iget everytime I try to run my Flash-movie. I've attached the codethat is contained in frame 1.The function bringUpEasyQuestion is defined on frame 2, alongwith other functions that are defined there. Now when I test themovie, I get this message:TypeError: Error #1009: Cannot access a property or method ofa null object reference.at MES_fla::MainTimeline/bringUpEasyQuestion()atMES_fla::MainTimeline/frame1()I've read that the Error1009-message means that you aretrying to access something that isn't there yet. And indeed, thebringUpEasyQuestion-function accesses objects that exist only onframe 2. But the first line of the function bringUpEasyQuestion isgotoAndStop(2);. The curious thing is that it works when i put thelast line of the code in frame one (the function callbringUpEasyQuestion(0);) on the first line
with the command gotoAndStop(2);?
I have two classes. The Main class calls a function, which is defined in a Second class.I'm getting the following error:Error 1120: Access of undefined property myFunctionBasically, I am creating buttons in the Main class that will add a corresponding Child to an Object in the Second class (if you click one button, child x1 will be added, if you click another button, child x2 will be added, and so forth).Here's the relevant code for the Main.as file:
package
{
import flash.display.MovieClip;
[code].....
I'm not sure that I'm on the right track here. I've got what is essentially a 'gateway' movieclip and depending on the CLICK a corresponding movieclip (form) is loaded -- these all being in their own AS file. There are multiple corresponding pages that will all load/close in their own fashion but the 'gateway' will reload in it's own function-- consequently, I have this function on the main_AS. Can I trigger this function from the sub class or do I need to move the 'reload' function to a 'reload' class.
View 2 Repliespackage asas
{
public class main extends EventDispatcher[code].....
I have this class and a MXML file... how will i call the function doCheck in button. When i call like this, it throws me an error.
<mx:Button
styleName="LoginButton"
id="loginButton" [code]...
I have a WCF web service (using basicHTTPBinding) which I am connecting to from a Flex application. I am using the FlexBuilder code generation to make a proxy for the web service.This has been working great until I tried to call a method on the web service that has no parameters. Here is it's interface declaration:
[OperationContract]
DateTime GetCurrentDateTime();
I then started getting HTTP 500 code responses from the service.Inspecting the HTTP response with Fiddler shows that WCF is reporting the following error:
Error in deserializing body of request message for operation 'GetCurrentDateTime'.
The OperationFormatter could not deserialize any information from the Message because the Message is empty (IsEmpty = true)
So it seems that there is an incompatability between Flex and WCF whan calling methods that have no paramaters - Flex doesn't include anything in the message but WCF is expecting something to be there.Is there any way to configure either Flex or WCF to work around this or am I going to have to include dummy parameters in such operation contracts?
How can I call a function in file1.as from file2.as?
here is the code.
package com.modestmaps
{
import com.modestmaps.overlays.MarkerClip;
import flash.display.Graphics;
[Code].....
in this package i am attempting to add the shadow, which works, and then add the infobubble, which works, and then add a main swf which works, and then add a close_button.swf which it does load the swf; however, when I try to add the listener, I am unable to make the infobubble close back up.
I have a function which makes a call to the server to load some financial data. This data is then displayed in a grid. In order to keep displaying the latest data I keep making this server call (every 30 secs). I'm using a Timer object to do this. The problem I have is that I have to wait 30 secs when the application starts for financial data to be displayed, what I'd like to happen is that the load data call is made, then start the update timer. Is there a way to set this up or shall I use to data load calls, one to get the initial data, then one to get the updates, which is made every 30 secs?
View 1 RepliesI need to call javascript function from Flash 4 based web application. When I run it in Debug mode it runs perfectly but when I make release build or run same application on other machine it does not call JavaScript function.
[Code]...
So I have an AS3 audio player which receives commands from Javascript.I have a function in the flash file called 'set_song', which sets the URL for the song to be played. The first time I call it using something like
Code:
document.getElementById('audio_player').set_song(response.url);
(response.url being the URL response from an AJAX call) it works fine and all the other functions on the player work fine but if I then run the same function a second time I get the "Error calling method on NPObject!" error in Firebug. I googled this and it said it was something to do with permissions but;
The site is at dftba[dot]com
The flash file is at dftba[dot]com
The javascript files are at [1/4][dot]cdns[dot]dftba[dot]com
The audio files are at vox[dot]dftba[dot]com
And I have
Code:
Security.allowDomain("dftba[dot]com");
Security.allowDomain("www[dot]dftba[dot]com");
Security.allowDomain("new[dot]dftba[dot]com");
[code]...
I am embedding a swf file into the parent swf file and my code in parent swf file want to call the function inside the embedded swf file. It always failed, below is the code. The error is in line:
var player:testflv1 = (loader.content as SystemManager).application as testflv1;
It can't be compiled because the testflv1 is not recognized as the known type.
[Code]...
I hope I have worded the question ok. I know that you can pass the 'id' of the component but I'm just wondering if there is a more generic way. I have tried using 'this' (shown in example below) but the 'this' keyword refers to the application.
[Code]...
Whenever I debug my AIR app it keeps suspending at a certain line of code...it doesn't give me a reason why, it just says Main Thread (Suspended) No error, no breakpoint at this location either. If I comment out the code so that, that line does not execute, it just does the same thing on a different line of code.
[Code].....
I have called this flash code in Flex using SWF loader . I got the following Error. Here I have attached flash coding for header_text_fla Kindly do the needful.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at header_text_fla::MainTimeline/loaderComplete()
var myEvent:Event;
var myParams:LoaderInfo;
[code]....
How do I get "close" button to run runFunction() from within component to outside declaration? FxGlobals.topLevelApplication doesn't seem to be working for this.
<fx:Declarations>
<fx:Component className="MyNativeWindow">
<s:Window>
[Code]....
If I need to call a specific function in the parent application from a child in a flex project, what's the best practice for this? Would it be to dispatch a custom event from the child and have a listener call that function? Or to directly call the function with FlexGlobals.topLevelApplication?
View 1 RepliesHow do I call a custom component's public function from the main app. For example, I've got a timer component, MyTimer.In the main app, I want to call startTimer() or stopTimer().In the main app, I've got:
<visualcomponent:MyTimer />
In the component, I've got:
public function startTimer():void {
[code].....