It turns out that’s it’s impossible to declare a class inside a embedded <fx:Script><![CDATA[
so it turns I need to put and include the actionscript code inside an external Sourcefile. The error is commented out
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="1955" minHeight="1600">
<fx:Script source="URLRequest.as" />
<s:layout>
<s:BasicLayout />
</s:layout>
<s:Panel x="0" y="0" width="955" height="600" title="Bypass">
<s:layout>
<s:BasicLayout />
</s:layout>
<s:Label x="1" y="1" text="Please enter the ɢɪᴛ repository ʜᴛᴛᴘ ᴜʀʟ :"/>
<s:TextInput x="224" y="1" width="726" id="txtName" text="http://ytrezq.sdfeu.org/flashredirect/?http"/>
<s:Button x="1" y="12" label="ɢɪᴛ push !" click="send()"/> <!-- Undefined Method method error -->
</s:Panel>
<fx:Declarations>
</fx:Declarations>
</s:Application>
and in URLRequest.as :
final public class MyClass {
// some stuff
}
public function send():void {
var request:Myclass=new Myclass(txtName.text);
// Some stuff with
}
So the question is simple but I couldn’t found the answer anywhere. At least not with for mxml with Spark.
send()
doesn’t need to be in a class and as you can see is outside a class. But it needs to use a custom class.
So how can I call send()
from URLRequest.as ?
I'm also not too sure what you're trying to do but here's a possible way:
Create an empty file called Myclass.as in the same folder as your .mxml file and insert these lines
Now get rid of
and replace it by
Now that I finally understand what you want to do, I've another idea - which is a little more complicated.
Create a file called Dummy.as and fill it with this:
Again, get rid of
and replace it by
and finally replace
with
The trick here is that we're importing the Dummy class that just has a static function which we can call without instantiating. Furthermore - as long as we define it outside of the package, we can add more class definitions, which are visible to the Dummy class.