access the property of the main class in loaded swf.
Hello
I have a main.fla, its document class is main.as. the code in main.as is
package
{
import flash.display.MovieClip;
SerializableAttribute public class Main extends MovieClip
{
private var loading: loading;
public var trovami:Number = 10;
public void Main()
{
stage.frameRate = 31;
loadSWF();
}
private function loadSWF (): void
{
loading = new Loading (this);
}
}
}
LOADIND. ACE is another class where I load another swf name is my_swf.
class loading code is:
package
{
import flash.display.MovieClip;
to import flash.display.SimpleButton;
import flash.text.TextField;
import flash.display.Loader;
import flash.events. *;
import flash.net.URLRequest;
SerializableAttribute public class loading extends MovieClip
{
private var _fla:MovieClip;
private var url: String;
public var val: String;
private var loader: Loader;
public void Loading(fla:MovieClip)
{
_fla = fla.
init();
}
private function init (): void
{
URL = 'my_swf.swf';
var request: URLRequest = new URLRequest (url);
loader = new Loader();
initListeners (loader.contentLoaderInfo);
Loader.Load (request);
}
private void initListeners(dispatcher:IEventDispatcher):void
{
dispatcher.addEventListener (Event.COMPLETE, complete);
}
private void completato(event:Event):void
{
_fla. AddChild (Loader);
Loader.y = 10;
Val = "Hello".
}
}
}
and the class of the loaded swf document is Main2. in my_swf.fla, there is a text, that his name is:
a_txt.
I so use class in Main2 for loading text property.
Code of Main.as is
package
{
import flash.display.MovieClip;
import flash.text. *;
Main2/public class extends MovieClip
{
public void Main2()
{
a_txt.text = val;
}
}
}
where val is the property of class loading.
so, how do I access.
You have a reference to your movie loaded into your class loader - instead of simply set val to string - add a method in your class Main2 - and call it loading - passing the string which him. Push not pull...
Hand 2 becomes:
public void Main2() {}
a_txt. Text = Val;
}
public void setText(val:String):void {}
a_txt. Text = val;
}
And then in your class loader - when you have finished loading only call setText:
private void completato(e:Event):void
{
addChild (loader);
Loader.y = 10;
MovieClip (loader.content) .setText ("hello");
Val = "Hello";
}
Tags: Adobe Animate
Similar Questions
-
Access the main object of a SWF file in memory
Hey.
I'm trying to access the main object of a SWF file in memory. Consider the following code:
package test {}
import flash.display.Sprite;
import flash.utils.ByteArray;
SerializableAttribute public class Main extends Sprite {}
public void Main (): void {}
var b:ByteArray = new ByteArray();
b.writeObject (this); This main object is what I'm trying to access
}
}
}
However, when I do a trace (b.length), the value I get does not match the length of the actual SWF file, then perhaps that there is another way.
I am trying to achieve the same type of content that you would get if you load an external SWF using loadBytes, unless I want to access the principal object of SWF (running in memory) in this way.
I have this even possible?
Thank you.Hey.
Well, I never knew a solution to it (if it is still possible to what I asked). However, I believe that I've implemented a workaround solution that should be enough for my needs. Perhaps it may help someone else too:
Although I can not (seem to) get the SWF running access itself to memory, I can load another copy of itself. When I tested the copy loaded (in memory) and compared with the content of the file on the disk, using a hex editor, content match!
This allows me to do things like control totals and which do not. An implementation is to use this technique to guard against the 'cache-hacking' of sovereign wealth funds.
-
To access the data that is loaded by the XML Loader class
Hi guys,.
I have trouble accessing the data loaded by external class.
Here is my code:
Main class:
package {}
import flash.display.MovieClip;
nucleus of import. XMLLoader;
SerializableAttribute public class Main extends MovieClip {}var projectSetupMainMenuXML:Boolean = true;
public void Main() {}
If {(projectSetupMainMenuXML)
var mainMenuXML = new XMLLoader ("menu.xml");
}
}
}
}XMLLoader class:
package base {}
import flash.display. *;
import flash.events. *;
flash.net import. *;
public class XMLLoader {}
private var mainMenu:XML;
private var urlLoader:URLLoader;
public function XMLLoader (mainMenuPath:String) {}
var urlRequest:URLRequest = new URLRequest (mainMenuPath);
urlLoader = new URLLoader();
urlLoader.addEventListener (Event.COMPLETE, completeListener);
urlLoader.load (urlRequest);
}
private void completeListener(e:Event):void {}
mainMenu = new XML (urlLoader.data);
e.target.removeEventListener (Event.COMPLETE, completeListener);
}
}
}Now, I want to create another external class (called MainMenu) which will be launched from the main class.
This class should create the menu based on the loaded XML class.
My question is, how can I make use of the loaded content through the XMLLoader class within the class MainMenu XML?
Thank you.
I think you have to use XMLLoader as a singleton - with the properties and static methods. In this way, you can load XML only once and make available XMl data to any object in the application.
-
error message "cannot load the main class.
I ran windows update yesterday and installed the recommended updates, restarted my laptop today the error message "Unable to load the main class" appears in a box and I couldn't do anything until I had closed this box, after the loading of firefox it displays a message not responding, then a bar indicating that plugin adobe did not start successfully so I clicked to reload page Then, I rebooted my laptop to see if this solves the problem, but the same error message appeared and firefox have responded in the same way, someone has an idea how I can fix this problem? I run anti-virus software and malware from comodo and my OS is windows vista 32. I also downloaded an update for adobe flash yesterday but the problem has not produced until after I had done the updates of windows. Thank you
Hello Fiona,
Thank you for your response.
You are facing this problem might because of Java program on your computer.
I suggest you perform the clean boot and check the status of the issue, which will help you identify the problem.
Keep the computer in a clean boot and check the status of the issue. If everything works well after a clean boot, you can deduce that some third-party services are at the origin of the problem. Continue with the remaining steps to pin-point on the third party service. After find you the program that is causing the problem, you will have to perhaps to update or install a newer version of the program, if you rarely use that you should consider uninstalling the software.
How to perform a clean boot for a problem in Windows Vista, Windows 7 or Windows 8.
http://support.Microsoft.com/kb/929135
Note: please go through the section:How to reset the computer to start as usual after a clean boot troubleshooting section of Kb to start the computer to a normal startup after you fix the problem.
Hope his helps.
-
original title: I need to know what means this message and I can remove it from my computer
doess someone knows what this message means? Could not load the manifest attribute of the main class of C; \program files\frostwire\commons-logging, pot every time I look at this subject in my file, it appears, I'm not good at all with computers but I know im short-term memory or space on this computer and I tried to go into my programs and delete, can you please help me understand what I can and can not delete to give me more space? Thanks, im running Windows Vista! If you would like more information, I'm sorry, just ask me? Thanks again, I hope someone can help me! :(
This discussion forum on Microsoft Security Essentials antimalware. You can get help in the Microsoft Vista answers forums - http://answers.microsoft.com/en-us/windows/forum/windows_vista
Jim
-
"Could not find the main class" Java error on Windows 7, but not Windows XP
Hi all
It's the first app I try to package and virtualize with ThinApp.
It is an old business application that usually runs on Windows XP SP3 x 86.
The. MSI that I generated with Thinapp works very well when it is installed on a Windows XP SP3 x 86.
However, our main goal to use Thinapp is to install on a Windows 7 SP1 x 64.
But in doing so, the application triggers a Java Virtual Machine Launcher error message saying: "could not find the main class. Program will exit. »
I thought that it was because the app includes a 1.4.2 JVM and that my XP has not any JVM pre-installed, but the main image on my W7 has a 1.7 JVM. But even after I uninstalled the 1.7 and installed JVM 1.4.2 on the W7 machine, I kept getting the error message so I guess that it is not bound.
Y at - it an option that I missed during my MSI generation so that it can run on a Windows 7 x 64?
Thank you all for your help.
D.
With the help of Lachi, we found that the app natively works on W7, no need for ThinApp it if the goal is just to make it work on W7, from a XP world.
The only change we had to make (and the error was the same ThinApp-ed, which is what I originally shared) is that the application should work with Windows 7 in "classic" mode "of the screen (without Aero and the menu start XP-style). This is because the application runs an old integrated version of Java (1.4) and it makes the system calls seeking specific .dll to display, which are not accessible by default if Aero is enabled.
Closed topic
-
Hi all
I am facing problem when I try to create the JAR file.
After creating the Jar file I tried to run but error message
Main class not found.
I follow these steps
(1) my WordNetOK.javaimport java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import edu.smu.tspell.wordnet.*; public class WordNetOK{ public static void main(String args[]) throws FileNotFoundException { System.setProperty("wordnet.database.dir", "C:\\Program Files (x86)\\WordNet\\2.1\\dict\\"); WordNetDatabase database = WordNetDatabase.getFileInstance(); String result = ""; NounSynset nounSynset; NounSynset[] hyponyms; //creating File instance to reference text file in Java File text = new File("C:/javacode/WordNetin.txt"); //Creating Scanner instnace to read File in Java Scanner scnr = new Scanner(text); //Reading each line of file using Scanner class int lineNumber = 1; while(scnr.hasNextLine()){ String line = scnr.nextLine(); Synset[] synsets = database.getSynsets(line); for (int i = 0; i < synsets.length; i++) { String[] wordForms = synsets.getWordForms();
for (int j = 0; j < wordForms.length; j++) {
System.out.println(wordForms[j]);
}
}
//System.out.println("line " + lineNumber + " :" + line);
lineNumber++;
}
}
}
Main-Class: WordNetOK2) Javac WordNetOK.java it create a class file 3) i create Manifeast.txt
C:\Javacode > jar cvfm WordNetOK.jar Manifest.txt WordNetOK.class4) i run this
Adding manifests
adding: WordNetOK.class(in = 743) (out = 435)(deflated 41%)
C:\Javacode > java-jar WordNetOK.jar5) i tried to execute it as * java -jar WordNetOK.jar * But error appear could not find main class
Exception in thread "main" java.lang.NoClassDefFoundError: WordNetOK
Caused by: java.lang.ClassNotFoundException: WordNetOK
in java.net.URLClassLoader$ 1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged (Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
to Sun.misc.Launcher$appclassloader$ AppClassLoader.loadClass (Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
The main class is not found: WordNetOK. Program ends.
C:\Javacode >
set PATH = C:\Program Files\Java\jdk1.6.0_32\bin;Note : i execute the classpath at beginning
set the classpath = C:\Program Files\Java\jdk1.6.0_32\bin;\javacode.
Edited by: Ayham on Apr 6, 2013 7:39 AM Edited by: Ayham on Apr 6, 2013 7:41 AM Edited by: Ayham on Apr 6, 2013 7:45 AM
Why are you creating your own manifest file? Let just for you Java.
It works for me using 1.6
C:\Javacode>jar cfe WordNetOK.jar WordNetOK WordNetOK.class C:\Javacode>java -jar WordNetOK.jar Hello World.
Generally, you should leave a tool (e.g., Netbeans, Ant) create the manifest because they know how to do it properly.
-
Pass a variable to the main class to a MovieClip
Hello!
I have a document with the main class.
I have also a few clips that have their own class and functions.
I'm trying to pass a variable in my main class to one of these clips.
I tried a few things, nothing has worked.
Who can help?
Match_Easy looks like a class name. You must use the name of the instance.
-
The main class and the class structure of game
Hello.
I m doing a game and now I wonder if it s handy to have a class named hand for my game.
I thought I'd have a Preloader, Console and play classes.
Now I Don t know.
Maybe better to have a main class that loads including a preloader that loads the Console that it s loads of game.
That s the best way to make an application of game? I m talking best practices.
And why if so there must be a main class that extends Sprite?
Thank you
What is in a name? It calls for what you want.
for the best practices in the design of the class, google: models of object-oriented design. It is a mature topic with lots of available information.
and your document class must extend sprite or movieclip classes because your fla document has a timeline (with one or more images).
-
The main class is not found: HelloWorldSwing
First lines of the file "HelloWorldSwing.java".
I've successfully compiled the file.package start; import javax.swing.*; public class HelloWorldSwing {
When I type the following command
I get the following error Message:C:\>java HelloWorldSwing
I'm sure that the absolute path of the file is:Could not find the main class: HelloWorldSwing. Program will exit.
C:\start\HelloWorldSwing.Java
and I issued the command of
C:\Your class is in a package. Its fully qualified name is start. HelloWorldSwing
DB
-
call the parent of a loaded swf file functions?
Hi all
I have a main Flash file that load other SWF files using loader objects. I want to be able to call the methods of this main purpose since then in the loaded SWF files. For example, I want the file loaded in order to add an event listener on the stage of the main file. I found this example:
That seems to do what I want, but I can't understand how to implement it in my setup.
My "main" file that loads other sovereign funds is called "main.swf" and has a main document class.
My loaded file is called start.swf and has a class of documents 'Start '.
in my main constructor:
var ethics_content:Loader = new Loader();
ethics_content. Load (new URLRequest ('start.swf'));
in the constructor of my departure:
If (this.parent.parent! = null) {/ / IF the STATEMENT FAILS}
var parentObj:Object = this.parent.parent as an object;
trace ("parentObj has been found.'");
} else {}
trace ("this .parent .parent is null.");
}
stage.addEventListener (MouseEvent.CLICK, handle_click); GENERATES AN ERROR WHEN IT IS LOADED TO THE HAND. SWFtrace ("step: ' + Stadium"); RETURNS A [STAGE] OBJECT BY OPERATING BY ITSELF, BUT NULL WHEN IT IS EXECUTED IN THE HAND. SWF
trace ("root:" + root); RETURNS AN OBJECT [START] WHEN RUN BY ITSELF OR WITHIN THE HAND. SWF
trace ("parent: ' + parent"); RETURNS A [STAGE] OBJECT BY OPERATING BY ITSELF, BUT NOTHING OF IN THE HAND. SWF
trace ("this .parent:" + this.parent); RETURNS OBJECT STAGE ITSELF, NOTHING OF IN THE HAND. SWF
trace ("root.parent:" + root.parent); RETURNS THE SCENE OBJECT BY ITSELFHow to get to the scene of a loaded SWF file? Or at least, how can I call a function in my main class from the loaded file start.swf so I can move the functionality I need the main.swf file?
Any help is greatly appreciated.
If your main swf loader is not added to the display list when it try {branch} is running, the charger will not have a parent.
-
How can I get the width of a loaded swf scene?
Is it possible to get the real of a loaded swf stageWidth?
The problem comes when the loaded swf file has some items off the stage. In this case content.width becomes bigger then the scene.
My code looks like this:
var request: URLRequest = new URLRequest (file.url);
var loader: Loader = new Loader();
Loader.Load (request);
loader.contentLoaderInfo.addEventListener (Event.INIT, CaseTailleAuto);
loader.contentLoaderInfo.addEventListener (Event.COMPLETE, addImg);
private void checkSize(e:Event) {}
That's where I need to see the width of my loaded swftrace (e.Target.Content.Width);
}
private void addImg(e:Event) {}
trace ("complete");
}
Thank you
Andrei
I don't think you can get the width of the stage of the loaded file, unless you assign it as a constant somewhere in the file. The loaded file loses its stage when it is loaded into another swf
-
How to access the instance property of the main class via child class
Hi I hv done 3 classes objecthandler, box and nav
NAV is child chass objecthandler, I hv make an instance of objecthandler box and now I want to access the property of box via NAV... See the code
Class Objecthandler
package code {}
import flash.display.MovieClip
import code.box
import code.nav
public class objectHandler extends MovieClip {}
public var container: box
public var navigation: navpublic void addObjects() {}
Navigation = new nav()
addChild (navigation)
navigation.addEvents)
navigation.x = 275
navigation.y = 400
container = new box()
addChild (container)
putcontainer ("default")< < works well here
}
public void putcontainer(page:String) {}
Container.OpenPage (page) < < when this function is executed it returns ("page is open"+ page)
}
}
}Class of NAV
package code {}
import flash.display.MovieClip
import flash.events.MouseEvent
import flash.display.DisplayObjectContainer
import code.box
public class nav extends objectHandler {}
public void nav() {}
}
public void addEvents() {}
homeBtn.addEventListener (MouseEvent.CLICK, releaseFun)
galleryBtn.addEventListener (MouseEvent.CLICK, releaseFun)
productsBtn.addEventListener (MouseEvent.CLICK, releaseFun)
contactBtn.addEventListener (MouseEvent.CLICK, releaseFun)
}
public void releaseFun(event:MouseEvent):void {}
putcontainer(Event.currentTarget.Name) < < showing the error over here
}
}
}You should review your logic.
It is not supposed have nav extend objectHandler and then has an objectHandler method that creates a new instance of nav.
-
How to access the main .mxml file component control?
I have a .mxml main while in which I imported custom "popUpWindow" component using the statement "import components.popUpWindow". In main .mxml file, I show more later this component in the form of pop-up window using the Popup Manager class:
var popUpWin:IFlexDisplayObject;
popUpWin = PopUpManager.createPopUp (Thi, popUpWindow, true);
Once the component is displayed, how can I access using the actionscript component TextInput control (specifically the .text property) my main .mxml file?
Thank youbdeen I think you have it bad: P I think he wants to access a property in the main application window.
Give the textInput id and then on your main application you can do this for example:
var test: String = popUpWin.textInputName.text;
Please note that it is recommended to do a casting for the popup window:
popUpWin = popUpWindow (PopUpManager.createPopUp (Thi, popUpWindow, true)); -
To access the upper class instance variables
Hello
See the code provided below. If home * variable 'i' is not set to 4, the output will be 3, if it is set, it will be 4.
My question is... Well, I don't know exactly, there would be a lot. All this is strange to me.
(For example, it seems that for the super class constructor runs when I access an instance of her variable).
Could someone explain this topic or maybe help me to direct to an article?
Note: Parent could also simply look like this:public class TryThis { public static void main (String args[]){ Child c = new Child(); c.seeSuper(); } } public class Parent { int i; Parent(){ i = 3; } } public class Child extends Parent{ Child(){ //i = 4; //*** } public void seeSuper(){ System.out.println(super.i); } }
public class Parent { int i = 3; }
I see now that it is wrong to use the word 'object '.
No, it isn't.
they are there for the child to use, object
That's where you're going wrong. Don't think about "the parent" and "child object. There is only one object, and it is mentioned by "this". You should think about members of the base or the classes and members of the (current) derived class. They are all members of the 'object', but the members of the base class can be hidden by the current members of class with the same name. That's all. Nothing too special about it.
but they aren't the fields of it.
Yes they are, but if they are hidden by local declarations that they are not visible to 'this', only to 'super '.
Maybe you are looking for
-
All of a sudden, I have no control on my Mac. Screens come and go, apps that I never started "leave unexpectedly. I started with D key is pressed and the verification by hdwe - everything is OK. I used the SHIFT key at startup in safe mode. It was OK
-
How to remove "bookmarks toolbar" drop to the bottom of the bookmark list?
How can I remove it? I also want to get rid of the "view bookmarks toolbar" and "show all bookmarks" if possible at all? I tried to play with userChrome.css and code but have not had such luck.
-
Stop Vista automatically on the Satellite A200-14F (PSAECE)
System stops - but re - start automatically. Have updated the BIOS, but still no luck. Have tried all the settings on Vista power options.
-
OfficeJet Pro 8500 A910g: OfficeJet Pro 8500 software on Windows 7
I use this printer for about three years, and about a year, when I clicked on the icon of the software OfficeJet, or tried to run from the program list window, nothing happened. A HP support agent sent me a link to the "HP Print Scan doctor and", an
-
Dear Sir. Some time before having a remider e-mail buttons in the toolbar. I had added more than two identification of email with the password. When we on my pc, if there is a new mail, they me and you can also remind connection by clicking on the mo