How to control a movieclip that was loaded using loadclip() in AS2? - actionscript-2

This is in AS2. I'm loading an external AS2 swf using the loadclip function.
But I don't know how to call its gotoAndPlay or stop functions. How do I reference to them?
When I trace the loaded file it says
_level0.mcContainer.instance42
The object path always varies every load like now it's instance42 sometimes it becomes instance7 or instance10.

Ok. I was wrong. instance42 refers to the anonymous instances inside the loaded swf. upon loading the loaded clip replaces the container movieclip, hence I can refer to the loaded swf using mcContainer.

Related

Is it possible to make WebView control to read local html files?

I'm making an application with WebView control. And I want it to read local html file. But I can't find the right way to make it possible.
At first, I simply tried to use Navigate method and provide the file path in the "file:///~" format string as a parameter, but it didn't work.
https://learn.microsoft.com/ja-jp/windows/communitytoolkit/controls/wpf-winforms/webview-known-issues
This Microsoft page says that WebView control does not recognize "file:///~" protocol.
And it shows the 3 solutions to make WebView control to read local html files.
Use NavigateToLocal() method.
Use NavigateToLocalStreamUri() method.
Use NavigateToString() method.
I tried all of them, but each 3 have some issues that doesn't make it work.
NavigateToLocal method requires a RELATIVE path of the file (not the absolute path), relative from the application executable directory. So files in somewhere else from the application directory cannot be read by this method.
NavigateToLocalStreamUri method is not even implemented according to the page! I once tried it anyway, but it returned an exception and didn't work.
NavigateToString method can render the given html content string, but the external files like css, js, image files included by html codes cannot be loaded, so it does not provide a full function.
I found some sample of using NavigateToLocalStreamUri method and tried it by myself.
(VB.NET)
wvwMain.NavigateToLocalStreamUri(uri, New StreamUriResolver())
Public Class StreamUriResolver : Implements IUriToStreamResolver
Public Function UriToStream(uri As Uri) As Stream Implements IUriToStreamResolver.UriToStream
Return New FileStream(uri.LocalPath, FileMode.Open)
End Function
End Class
By this code, NavigateToLocalStreamUri method returns System.Resources.MissingManifestResourceException.
What I want to realize is very simple.
Using WebView control
Read local html file located anywhere on the local storage
And render the html file completely as an expected result
But I don't see the way right now.
I would appreciate your advises or helps.
The method NavigateToLocalStreamUri will not work. Please see https://learn.microsoft.com/en-us/windows/communitytoolkit/controls/wpf-winforms/webview-known-issues.
You have to use NavigateToLocal, but you will see a warning that it is deprecated. However, it does only work with relative paths. Is it possible for you to restructure your application so that you can use relative paths?
The NavigateToLocal method is the only way that I've found to call local HTML files in Microsoft.Toolkit.Forms.UI.Controls.Web WebView v6.0.
On Visual Studio 2019 Windows 10, the following VB.NET code works on my PC
Imports System.IO
Dim sFileName = Application.StartupPath & "/MyPage.html"
wv.NavigateToString(System.IO.File.ReadAllText(sFileName))
where wv is a WebView object.

Can JSFL be used to set a Global Include script?

We are converting several thousand .FLA files from SWF (Flash CS6) to HTML5 Canvas (Animate CC format). I have already written a JSFL script that automates the process:
Converts Compiled Clips to HTML5-friendly objects
Converts document to HTML5 Canvas format
Associates a new Publish Profile and HTML template with the document
Changes the publish filenames
So, the hard part is done! But I want to optimize it a bit more.
The current HTML template has some shared utility functions. The utility functions add 5-10kb to the file size of each animation, which themselves are probably in the 20-50kb range.
I would rather include these utility functions by setting a Global Include script, going to the top-left of the Actions panel, selecting Include, and adding a script with the + key. (When I'm done, it will show the URI underneath Global Script)
This produces the output I want, and it's perfect! The only downside is, I have to do this manually -- I'd like a way to associate the .JS file as a Global Include when running my JSFL conversion script.
Does anyone know of a JSAPI method to retrieve or set a Global Include script in HTML5 Canvas documents?
I haven't been able to find any documentation on such a function in JSFL/JSAPI. It doesn't seem like setting the scripts leaves a trace in the History pane, so I'm at a loss here.

Javafx dynamically fxml load at Runtime

I have an application that cover a wide number of use cases each with completely independent workflows but workflows are pretty static after installation.
I have therefore created an HBox placeholder that will load the workflow for an installation.
Is there a way to dynamically load a section of the fxml from a database or a separate file archive? This fpml will have to have its own set of images and resources needed to achieve the workflows functionality.
TBH, I don't know where to start on this one.
Regards
I do not quite understand your problem. You can modify the scene graph at any time you want. So, of course it is possible to load a part of the scene graph from an FXML file at any time and hook it up to the already existing part. In your controller you have access to your HBox placeholder and when you have loaded the second part of the scene graph you can just add it via hbox.getChildren().add(newpart), were newpart is the root node of your second scene graph part. Of course you have to make sure that the layout works correctly for your constellation.
Your question seems nonsense because the FXML is always loaded dynamically. My guess is you are confused because most of the examples use FXML in the same bundle as the classes and so are loaded trough the getResource method. But the FXML loader takes any kind of InputStream, so you can just open a database blob or a file as an InputStream and give that InputStream as an argument to the loader. Be sure to catch the runtime exceptions though :)
Hope this helps.

AS2 AttachMovie from loaded swf movie

i'm facing one problem about attaching movieclip from loaded movie, so basically we have a Map
Map.loadMovie("SimpleMap.swf");
in this map there's a npc dialogue with its name "Dialogue1" I want to attach it to the client. It should be basically something like
_root.attachMovie("Map.Dialogue1", "dialogue", _root.getNextHighestDepth());
but it seems I can't get it to work. Anyone can help?
Note: Also I want to attach the movieclip to the client instead of the map, else I would use Map.attachMovie
it's been a while since I wrote any Actionscript 2 stuff, but have you tried removing the quotes around Map.Dialogue1 ? - If I remember correctly passing a string would make Flash look for the symbol in the library, not from the global or current scope...
_root.attachMovie(Map.Dialogue1, "dialogue", _root.getNextHighestDepth());
If you want you can import mx.core.UIObject and then use the method _root.createObject() (or if it is O-O use createClassObject()).
It is going to attach the "npc dialog" as an object... you need to specify the linkage name and give the instance a name. So for example if you called the dialog "npc_dialog" in the library then use:
_root.createObject("npc_dialog", "my_npc", _root.getNextHighestDepth());
Here is something else you can try... go to the library and drag a instance of the movie onto the stage somewhere where it will not be seen, like for instance on the next key frame or off the stage then try to run attachMovie().
What happens is flash will compile the clip in the most efficient way possible so if it sees you imported a package but did not use it then it will ignore this class in the compiled clip... so when you go to run and it tries to attach the movie it can't find it.

pharo - run a code when server starts

I am using ZnZincServerAdapter and have a web server. I now want to make sure that when I start this server there should be a piece of code that gets executed. how can this be done ?
basically i have a web app in smalltalk so I when I go to that URL , i want the previous heavy piece of code to be executed when I start my server and not when I load my page.
You can this from within the image or when you start it. For within the image have a look at
Smalltalk>>#addToStartUpList:
This registers a class that will be executed when the image starts. You need to implement the methods startUp: and shutDown: in your class. Those will be called on start/stop of the image.
Or you can do it when starting the image. If you provide an argument (needs to be the first argument) to the image that is a file (absolute path necessary) the image will read the file in and execute it